file_name
stringlengths
5
52
name
stringlengths
4
95
original_source_type
stringlengths
0
23k
source_type
stringlengths
9
23k
source_definition
stringlengths
9
57.9k
source
dict
source_range
dict
file_context
stringlengths
0
721k
dependencies
dict
opens_and_abbrevs
listlengths
2
94
vconfig
dict
interleaved
bool
1 class
verbose_type
stringlengths
1
7.42k
effect
stringclasses
118 values
effect_flags
sequencelengths
0
2
mutual_with
sequencelengths
0
11
ideal_premises
sequencelengths
0
236
proof_features
sequencelengths
0
1
is_simple_lemma
bool
2 classes
is_div
bool
2 classes
is_proof
bool
2 classes
is_simply_typed
bool
2 classes
is_type
bool
2 classes
partial_definition
stringlengths
5
3.99k
completed_definiton
stringlengths
1
1.63M
isa_cross_project_example
bool
1 class
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.valid_list_cons_recip
val valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (pos <> pos' /\ valid_list p h sl pos pos')) (ensures (pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ (let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos')) )
val valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (pos <> pos' /\ valid_list p h sl pos pos')) (ensures (pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ (let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos')) )
let valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( pos <> pos' /\ valid_list p h sl pos pos' )) (ensures ( pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos' ))) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos'
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 34, "end_line": 2005, "start_col": 0, "start_line": 1982 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' )))) let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos' val contents_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost (list t) (requires (valid_list p h sl pos pos')) (ensures (fun _ -> True)) (decreases (U32.v pos' - U32.v pos)) val contents_list_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (contents_list p h sl pos pos' == ( valid_list_equiv p h sl pos pos'; if pos = pos' then [] else contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' ))) let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_list p h sl pos pos /\ contents_list p h sl pos pos == [] )) = valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos let valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' )) (ensures ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' )) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' module L = FStar.List.Tot
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: LowParse.Spec.Base.parser k t -> h: FStar.Monotonic.HyperStack.mem -> sl: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> pos': FStar.UInt32.t -> FStar.Pervasives.Lemma (requires pos <> pos' /\ LowParse.Low.Base.Spec.valid_list p h sl pos pos') (ensures pos <> pos' /\ LowParse.Low.Base.Spec.valid_list p h sl pos pos' /\ LowParse.Low.Base.Spec.valid p h sl pos /\ (let pos1 = LowParse.Low.Base.Spec.get_valid_pos p h sl pos in LowParse.Low.Base.Spec.valid_list p h sl pos1 pos' /\ LowParse.Low.Base.Spec.contents_list p h sl pos pos' == LowParse.Low.Base.Spec.contents p h sl pos :: LowParse.Low.Base.Spec.contents_list p h sl pos1 pos'))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.contents_list_eq", "Prims.unit", "LowParse.Low.Base.Spec.valid_list_equiv", "Prims.l_and", "Prims.b2t", "Prims.op_disEquality", "LowParse.Low.Base.Spec.valid_list", "Prims.squash", "LowParse.Low.Base.Spec.valid", "Prims.eq2", "Prims.list", "LowParse.Low.Base.Spec.contents_list", "Prims.Cons", "LowParse.Low.Base.Spec.contents", "LowParse.Low.Base.Spec.get_valid_pos", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (pos <> pos' /\ valid_list p h sl pos pos')) (ensures (pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ (let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos')) ) =
valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos'
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.slice_access'
val slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p1 h sl pos)) (ensures (fun pos' -> True))
val slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p1 h sl pos)) (ensures (fun pos' -> True))
let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small)
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 39, "end_line": 1698, "start_col": 0, "start_line": 1678 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> g: LowParse.Low.Base.Spec.gaccessor p1 p2 cl -> sl: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> Prims.Ghost FStar.UInt32.t
Prims.Ghost
[]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "FStar.Monotonic.HyperStack.mem", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Low.Base.Spec.clens", "LowParse.Low.Base.Spec.gaccessor", "LowParse.Slice.slice", "FStar.UInt32.t", "FStar.UInt32.add", "FStar.UInt32.uint_to_t", "LowParse.Bytes.bytes", "LowParse.Slice.bytes_of_slice_from", "LowParse.Low.Base.Spec.valid", "Prims.l_True" ]
[]
false
false
false
false
false
let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p1 h sl pos)) (ensures (fun pos' -> True)) =
let small = bytes_of_slice_from h sl pos in pos `U32.add` (U32.uint_to_t (g small))
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.gaccessor_compose'
val gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res))
val gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res))
let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 13, "end_line": 1564, "start_col": 0, "start_line": 1545 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a12: LowParse.Low.Base.Spec.gaccessor p1 p2 cl12 -> a23: LowParse.Low.Base.Spec.gaccessor p2 p3 cl23 -> input: LowParse.Bytes.bytes -> Prims.Ghost Prims.nat
Prims.Ghost
[]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Low.Base.Spec.clens", "LowParse.Low.Base.Spec.gaccessor", "LowParse.Bytes.bytes", "Prims.op_Addition", "Prims.nat", "FStar.Seq.Base.seq", "LowParse.Bytes.byte", "FStar.Seq.Base.slice", "FStar.Seq.Base.length", "Prims.l_True", "LowParse.Low.Base.Spec.gaccessor_post'", "LowParse.Low.Base.Spec.clens_compose" ]
[]
false
false
false
false
false
let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) =
let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.slice_access_frame_weak
val slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos))) (ensures (valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos)) [ SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')] ] ]
val slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos))) (ensures (valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos)) [ SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')] ] ]
let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 58, "end_line": 1812, "start_col": 0, "start_line": 1777 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> g: LowParse.Low.Base.Spec.gaccessor p1 p2 cl -> sl: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> l: LowStar.Monotonic.Buffer.loc -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires LowParse.Low.Base.Spec.valid p1 h sl pos /\ Mkclens?.clens_cond cl (LowParse.Low.Base.Spec.contents p1 h sl pos) /\ LowStar.Monotonic.Buffer.modifies l h h' /\ LowStar.Monotonic.Buffer.loc_disjoint l (LowParse.Slice.loc_slice_from sl pos)) (ensures LowParse.Low.Base.Spec.valid p1 h' sl pos /\ Mkclens?.clens_cond cl (LowParse.Low.Base.Spec.contents p1 h' sl pos) /\ LowParse.Low.Base.Spec.slice_access h' g sl pos == LowParse.Low.Base.Spec.slice_access h g sl pos) [ SMTPatOr [ [ SMTPat (LowParse.Low.Base.Spec.slice_access h g sl pos); SMTPat (LowStar.Monotonic.Buffer.modifies l h h') ]; [ SMTPat (LowParse.Low.Base.Spec.slice_access h' g sl pos); SMTPat (LowStar.Monotonic.Buffer.modifies l h h') ] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "FStar.Monotonic.HyperStack.mem", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Low.Base.Spec.clens", "LowParse.Low.Base.Spec.gaccessor", "LowParse.Slice.slice", "FStar.UInt32.t", "LowStar.Monotonic.Buffer.loc", "LowStar.Monotonic.Buffer.modifies_buffer_from_to_elim", "LowParse.Slice.buffer_srel_of_srel", "LowParse.Slice.__proj__Mkslice__item__base", "LowParse.Slice.__proj__Mkslice__item__len", "Prims.unit", "LowParse.Low.Base.Spec.slice_access_eq", "LowParse.Low.Base.Spec.valid_facts", "Prims.l_and", "LowParse.Low.Base.Spec.valid", "LowParse.Low.Base.Spec.__proj__Mkclens__item__clens_cond", "LowParse.Low.Base.Spec.contents", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_disjoint", "LowParse.Slice.loc_slice_from", "Prims.squash", "Prims.eq2", "LowParse.Low.Base.Spec.slice_access", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat_or", "Prims.list", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
true
false
true
false
false
let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos))) (ensures (valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos)) [ SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')] ] ] =
valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.valid_list_elim
val valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len)) [SMTPat (valid_list p h sl pos pos')]
val valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len)) [SMTPat (valid_list p h sl pos pos')]
let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos'
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 34, "end_line": 1905, "start_col": 0, "start_line": 1886 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' ))))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: LowParse.Spec.Base.parser k t -> h: FStar.Monotonic.HyperStack.mem -> sl: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> pos': FStar.UInt32.t -> FStar.Pervasives.Lemma (requires LowParse.Low.Base.Spec.valid_list p h sl pos pos') (ensures Mkparser_kind'?.parser_kind_subkind k == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\ Mkparser_kind'?.parser_kind_low k > 0 /\ LowParse.Slice.live_slice h sl /\ FStar.UInt32.v pos <= FStar.UInt32.v pos' /\ FStar.UInt32.v pos' <= FStar.UInt32.v (Mkslice?.len sl)) [SMTPat (LowParse.Low.Base.Spec.valid_list p h sl pos pos')]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.valid_list_equiv", "Prims.unit", "LowParse.Low.Base.Spec.valid_list", "Prims.squash", "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", "Prims.b2t", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "LowParse.Slice.live_slice", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "LowParse.Slice.__proj__Mkslice__item__len", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
true
false
true
false
false
let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len)) [SMTPat (valid_list p h sl pos pos')] =
valid_list_equiv p h sl pos pos'
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.slice_access_post
val slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos))) (ensures (let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos)) [SMTPat (slice_access h g sl pos)]
val slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos))) (ensures (let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos)) [SMTPat (slice_access h g sl pos)]
let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 25, "end_line": 1775, "start_col": 0, "start_line": 1744 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> g: LowParse.Low.Base.Spec.gaccessor p1 p2 cl -> sl: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> FStar.Pervasives.Lemma (requires LowParse.Low.Base.Spec.valid p1 h sl pos /\ Mkclens?.clens_cond cl (LowParse.Low.Base.Spec.contents p1 h sl pos)) (ensures (let pos' = LowParse.Low.Base.Spec.slice_access h g sl pos in LowParse.Low.Base.Spec.valid p2 h sl pos' /\ LowParse.Low.Base.Spec.contents p2 h sl pos' == Mkclens?.clens_get cl (LowParse.Low.Base.Spec.contents p1 h sl pos) /\ FStar.UInt32.v pos <= FStar.UInt32.v pos' /\ FStar.UInt32.v pos' + LowParse.Low.Base.Spec.content_length p2 h sl pos' <= FStar.UInt32.v pos + LowParse.Low.Base.Spec.content_length p1 h sl pos)) [SMTPat (LowParse.Low.Base.Spec.slice_access h g sl pos)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "FStar.Monotonic.HyperStack.mem", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Low.Base.Spec.clens", "LowParse.Low.Base.Spec.gaccessor", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.valid_facts", "LowParse.Low.Base.Spec.slice_access'", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "Prims.pow2", "LowParse.Low.Base.Spec.slice_access_eq", "Prims.l_and", "LowParse.Low.Base.Spec.valid", "LowParse.Low.Base.Spec.__proj__Mkclens__item__clens_cond", "LowParse.Low.Base.Spec.contents", "Prims.squash", "LowParse.Low.Base.Spec.__proj__Mkclens__item__clens_get", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "Prims.op_Addition", "LowParse.Low.Base.Spec.content_length", "LowParse.Low.Base.Spec.slice_access", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
true
false
true
false
false
let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos))) (ensures (let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos)) [SMTPat (slice_access h g sl pos)] =
slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.valid_list_nil
val valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures (valid_list p h sl pos pos /\ contents_list p h sl pos pos == []))
val valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures (valid_list p h sl pos pos /\ contents_list p h sl pos pos == []))
let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_list p h sl pos pos /\ contents_list p h sl pos pos == [] )) = valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 33, "end_line": 1955, "start_col": 0, "start_line": 1940 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' )))) let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos' val contents_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost (list t) (requires (valid_list p h sl pos pos')) (ensures (fun _ -> True)) (decreases (U32.v pos' - U32.v pos)) val contents_list_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (contents_list p h sl pos pos' == ( valid_list_equiv p h sl pos pos'; if pos = pos' then [] else contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' )))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: LowParse.Spec.Base.parser k t -> h: FStar.Monotonic.HyperStack.mem -> sl: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> FStar.Pervasives.Lemma (requires FStar.UInt32.v pos <= FStar.UInt32.v (Mkslice?.len sl) /\ LowParse.Slice.live_slice h sl /\ Mkparser_kind'?.parser_kind_low k > 0 /\ Mkparser_kind'?.parser_kind_subkind k == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong) (ensures LowParse.Low.Base.Spec.valid_list p h sl pos pos /\ LowParse.Low.Base.Spec.contents_list p h sl pos pos == [])
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.contents_list_eq", "Prims.unit", "LowParse.Low.Base.Spec.valid_list_equiv", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "LowParse.Slice.__proj__Mkslice__item__len", "LowParse.Slice.live_slice", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "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", "Prims.squash", "LowParse.Low.Base.Spec.valid_list", "Prims.list", "LowParse.Low.Base.Spec.contents_list", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures (valid_list p h sl pos pos /\ contents_list p h sl pos pos == [])) =
valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.valid_list_append
val valid_list_append (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2 pos3: U32.t) : Lemma (requires (valid_list p h sl pos1 pos2 /\ valid_list p h sl pos2 pos3)) (ensures (valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == (contents_list p h sl pos1 pos2) `L.append` (contents_list p h sl pos2 pos3))) (decreases (U32.v pos2 - U32.v pos1))
val valid_list_append (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2 pos3: U32.t) : Lemma (requires (valid_list p h sl pos1 pos2 /\ valid_list p h sl pos2 pos3)) (ensures (valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == (contents_list p h sl pos1 pos2) `L.append` (contents_list p h sl pos2 pos3))) (decreases (U32.v pos2 - U32.v pos1))
let rec valid_list_append (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2 pos3 : U32.t) : Lemma (requires ( valid_list p h sl pos1 pos2 /\ valid_list p h sl pos2 pos3 )) (ensures ( valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == contents_list p h sl pos1 pos2 `L.append` contents_list p h sl pos2 pos3 )) (decreases (U32.v pos2 - U32.v pos1)) = if pos1 = pos2 then valid_list_nil p h sl pos1 else begin valid_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_list_append p h sl pos15 pos2 pos3; valid_list_cons p h sl pos1 pos3 end
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 5, "end_line": 2120, "start_col": 0, "start_line": 2094 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' )))) let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos' val contents_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost (list t) (requires (valid_list p h sl pos pos')) (ensures (fun _ -> True)) (decreases (U32.v pos' - U32.v pos)) val contents_list_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (contents_list p h sl pos pos' == ( valid_list_equiv p h sl pos pos'; if pos = pos' then [] else contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' ))) let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_list p h sl pos pos /\ contents_list p h sl pos pos == [] )) = valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos let valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' )) (ensures ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' )) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( pos <> pos' /\ valid_list p h sl pos pos' )) (ensures ( pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos' ))) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' let rec valid_list_frame_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h s pos pos')) (ensures ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h s pos pos'; contents_list_eq p h s pos pos' ; valid_list_equiv p h' s pos pos' ; begin if pos = pos' then () else begin let pos1 = get_valid_pos p h s pos in valid_list_frame_1 p h s pos1 pos' l h' end end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h' s pos pos' let rec valid_list_frame_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h' s pos pos')) (ensures ( valid_list p h' s pos pos' /\ valid_list p h s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h' s pos pos' ; contents_list_eq p h' s pos pos' ; valid_list_equiv p h s pos pos' ; if pos = pos' then () else begin let pos1 = get_valid_pos p h' s pos in valid_valid_exact p h' s pos; valid_exact_valid p h s pos pos1; valid_list_frame_2 p h s pos1 pos' l h' end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h s pos pos' let valid_list_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_list p h s pos pos' \/ valid_list p h' s pos pos') ==> ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_list p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = Classical.move_requires (valid_list_frame_1 p h s pos pos' l) h'; Classical.move_requires (valid_list_frame_2 p h s pos pos' l) h'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: LowParse.Spec.Base.parser k t -> h: FStar.Monotonic.HyperStack.mem -> sl: LowParse.Slice.slice rrel rel -> pos1: FStar.UInt32.t -> pos2: FStar.UInt32.t -> pos3: FStar.UInt32.t -> FStar.Pervasives.Lemma (requires LowParse.Low.Base.Spec.valid_list p h sl pos1 pos2 /\ LowParse.Low.Base.Spec.valid_list p h sl pos2 pos3) (ensures LowParse.Low.Base.Spec.valid_list p h sl pos1 pos3 /\ LowParse.Low.Base.Spec.contents_list p h sl pos1 pos3 == LowParse.Low.Base.Spec.contents_list p h sl pos1 pos2 @ LowParse.Low.Base.Spec.contents_list p h sl pos2 pos3) (decreases FStar.UInt32.v pos2 - FStar.UInt32.v pos1)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.slice", "FStar.UInt32.t", "Prims.op_Equality", "LowParse.Low.Base.Spec.valid_list_nil", "Prims.bool", "LowParse.Low.Base.Spec.valid_list_cons", "Prims.unit", "LowParse.Low.Base.Spec.valid_list_append", "LowParse.Low.Base.Spec.get_valid_pos", "LowParse.Low.Base.Spec.valid_list_cons_recip", "Prims.l_and", "LowParse.Low.Base.Spec.valid_list", "Prims.squash", "Prims.eq2", "Prims.list", "LowParse.Low.Base.Spec.contents_list", "FStar.List.Tot.Base.append", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "recursion" ]
false
false
true
false
false
let rec valid_list_append (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2 pos3: U32.t) : Lemma (requires (valid_list p h sl pos1 pos2 /\ valid_list p h sl pos2 pos3)) (ensures (valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == (contents_list p h sl pos1 pos2) `L.append` (contents_list p h sl pos2 pos3))) (decreases (U32.v pos2 - U32.v pos1)) =
if pos1 = pos2 then valid_list_nil p h sl pos1 else (valid_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_list_append p h sl pos15 pos2 pos3; valid_list_cons p h sl pos1 pos3)
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.valid_list_snoc
val valid_list_snoc (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2: U32.t) : Lemma (requires (valid_list p h sl pos1 pos2 /\ valid p h sl pos2)) (ensures (let pos3 = get_valid_pos p h sl pos2 in valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == (contents_list p h sl pos1 pos2) `L.append` [contents p h sl pos2]))
val valid_list_snoc (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2: U32.t) : Lemma (requires (valid_list p h sl pos1 pos2 /\ valid p h sl pos2)) (ensures (let pos3 = get_valid_pos p h sl pos2 in valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == (contents_list p h sl pos1 pos2) `L.append` [contents p h sl pos2]))
let valid_list_snoc (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2 : U32.t) : Lemma (requires ( valid_list p h sl pos1 pos2 /\ valid p h sl pos2 )) (ensures ( let pos3 = get_valid_pos p h sl pos2 in valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == contents_list p h sl pos1 pos2 `L.append` [contents p h sl pos2] )) = let pos3 = get_valid_pos p h sl pos2 in valid_list_nil p h sl pos3; valid_list_cons p h sl pos2 pos3; valid_list_append p h sl pos1 pos2 pos3
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 41, "end_line": 2143, "start_col": 0, "start_line": 2122 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' )))) let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos' val contents_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost (list t) (requires (valid_list p h sl pos pos')) (ensures (fun _ -> True)) (decreases (U32.v pos' - U32.v pos)) val contents_list_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (contents_list p h sl pos pos' == ( valid_list_equiv p h sl pos pos'; if pos = pos' then [] else contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' ))) let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_list p h sl pos pos /\ contents_list p h sl pos pos == [] )) = valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos let valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' )) (ensures ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' )) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( pos <> pos' /\ valid_list p h sl pos pos' )) (ensures ( pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos' ))) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' let rec valid_list_frame_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h s pos pos')) (ensures ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h s pos pos'; contents_list_eq p h s pos pos' ; valid_list_equiv p h' s pos pos' ; begin if pos = pos' then () else begin let pos1 = get_valid_pos p h s pos in valid_list_frame_1 p h s pos1 pos' l h' end end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h' s pos pos' let rec valid_list_frame_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h' s pos pos')) (ensures ( valid_list p h' s pos pos' /\ valid_list p h s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h' s pos pos' ; contents_list_eq p h' s pos pos' ; valid_list_equiv p h s pos pos' ; if pos = pos' then () else begin let pos1 = get_valid_pos p h' s pos in valid_valid_exact p h' s pos; valid_exact_valid p h s pos pos1; valid_list_frame_2 p h s pos1 pos' l h' end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h s pos pos' let valid_list_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_list p h s pos pos' \/ valid_list p h' s pos pos') ==> ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_list p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = Classical.move_requires (valid_list_frame_1 p h s pos pos' l) h'; Classical.move_requires (valid_list_frame_2 p h s pos pos' l) h' let rec valid_list_append (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2 pos3 : U32.t) : Lemma (requires ( valid_list p h sl pos1 pos2 /\ valid_list p h sl pos2 pos3 )) (ensures ( valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == contents_list p h sl pos1 pos2 `L.append` contents_list p h sl pos2 pos3 )) (decreases (U32.v pos2 - U32.v pos1)) = if pos1 = pos2 then valid_list_nil p h sl pos1 else begin valid_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_list_append p h sl pos15 pos2 pos3; valid_list_cons p h sl pos1 pos3 end
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: LowParse.Spec.Base.parser k t -> h: FStar.Monotonic.HyperStack.mem -> sl: LowParse.Slice.slice rrel rel -> pos1: FStar.UInt32.t -> pos2: FStar.UInt32.t -> FStar.Pervasives.Lemma (requires LowParse.Low.Base.Spec.valid_list p h sl pos1 pos2 /\ LowParse.Low.Base.Spec.valid p h sl pos2) (ensures (let pos3 = LowParse.Low.Base.Spec.get_valid_pos p h sl pos2 in LowParse.Low.Base.Spec.valid_list p h sl pos1 pos3 /\ LowParse.Low.Base.Spec.contents_list p h sl pos1 pos3 == LowParse.Low.Base.Spec.contents_list p h sl pos1 pos2 @ [LowParse.Low.Base.Spec.contents p h sl pos2]))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.valid_list_append", "Prims.unit", "LowParse.Low.Base.Spec.valid_list_cons", "LowParse.Low.Base.Spec.valid_list_nil", "LowParse.Low.Base.Spec.get_valid_pos", "Prims.l_and", "LowParse.Low.Base.Spec.valid_list", "LowParse.Low.Base.Spec.valid", "Prims.squash", "Prims.eq2", "Prims.list", "LowParse.Low.Base.Spec.contents_list", "FStar.List.Tot.Base.append", "Prims.Cons", "LowParse.Low.Base.Spec.contents", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_list_snoc (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2: U32.t) : Lemma (requires (valid_list p h sl pos1 pos2 /\ valid p h sl pos2)) (ensures (let pos3 = get_valid_pos p h sl pos2 in valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == (contents_list p h sl pos1 pos2) `L.append` [contents p h sl pos2])) =
let pos3 = get_valid_pos p h sl pos2 in valid_list_nil p h sl pos3; valid_list_cons p h sl pos2 pos3; valid_list_append p h sl pos1 pos2 pos3
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.list_length_append
val list_length_append (#t: Type) (l1 l2: list t) : Lemma (L.length (l1 `L.append` l2) == L.length l1 + L.length l2)
val list_length_append (#t: Type) (l1 l2: list t) : Lemma (L.length (l1 `L.append` l2) == L.length l1 + L.length l2)
let list_length_append (#t: Type) (l1 l2: list t) : Lemma (L.length (l1 `L.append` l2) == L.length l1 + L.length l2) = L.append_length l1 l2
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 140, "end_line": 2178, "start_col": 0, "start_line": 2178 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' )))) let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos' val contents_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost (list t) (requires (valid_list p h sl pos pos')) (ensures (fun _ -> True)) (decreases (U32.v pos' - U32.v pos)) val contents_list_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (contents_list p h sl pos pos' == ( valid_list_equiv p h sl pos pos'; if pos = pos' then [] else contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' ))) let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_list p h sl pos pos /\ contents_list p h sl pos pos == [] )) = valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos let valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' )) (ensures ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' )) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( pos <> pos' /\ valid_list p h sl pos pos' )) (ensures ( pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos' ))) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' let rec valid_list_frame_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h s pos pos')) (ensures ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h s pos pos'; contents_list_eq p h s pos pos' ; valid_list_equiv p h' s pos pos' ; begin if pos = pos' then () else begin let pos1 = get_valid_pos p h s pos in valid_list_frame_1 p h s pos1 pos' l h' end end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h' s pos pos' let rec valid_list_frame_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h' s pos pos')) (ensures ( valid_list p h' s pos pos' /\ valid_list p h s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h' s pos pos' ; contents_list_eq p h' s pos pos' ; valid_list_equiv p h s pos pos' ; if pos = pos' then () else begin let pos1 = get_valid_pos p h' s pos in valid_valid_exact p h' s pos; valid_exact_valid p h s pos pos1; valid_list_frame_2 p h s pos1 pos' l h' end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h s pos pos' let valid_list_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_list p h s pos pos' \/ valid_list p h' s pos pos') ==> ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_list p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = Classical.move_requires (valid_list_frame_1 p h s pos pos' l) h'; Classical.move_requires (valid_list_frame_2 p h s pos pos' l) h' let rec valid_list_append (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2 pos3 : U32.t) : Lemma (requires ( valid_list p h sl pos1 pos2 /\ valid_list p h sl pos2 pos3 )) (ensures ( valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == contents_list p h sl pos1 pos2 `L.append` contents_list p h sl pos2 pos3 )) (decreases (U32.v pos2 - U32.v pos1)) = if pos1 = pos2 then valid_list_nil p h sl pos1 else begin valid_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_list_append p h sl pos15 pos2 pos3; valid_list_cons p h sl pos1 pos3 end let valid_list_snoc (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos1 pos2 : U32.t) : Lemma (requires ( valid_list p h sl pos1 pos2 /\ valid p h sl pos2 )) (ensures ( let pos3 = get_valid_pos p h sl pos2 in valid_list p h sl pos1 pos3 /\ contents_list p h sl pos1 pos3 == contents_list p h sl pos1 pos2 `L.append` [contents p h sl pos2] )) = let pos3 = get_valid_pos p h sl pos2 in valid_list_nil p h sl pos3; valid_list_cons p h sl pos2 pos3; valid_list_append p h sl pos1 pos2 pos3 (* size of a list of serialized data (should be taken from serialize_list) *) val serialized_list_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (l: list t) : GTot nat val serialized_list_length_nil (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Lemma (serialized_list_length s [] == 0) val serialized_list_length_cons (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) (q: list t) : Lemma (serialized_list_length s (x :: q) == serialized_length s x + serialized_list_length s q) val serialized_list_length_append (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (l1 l2: list t) : Lemma (serialized_list_length s (List.Tot.append l1 l2) == serialized_list_length s l1 + serialized_list_length s l2) val valid_list_serialized_list_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (#rrel #rel: _) (input: slice rrel rel) (pos pos' : U32.t) : Lemma (requires ( valid_list p h input pos pos' )) (ensures ( serialized_list_length s (contents_list p h input pos pos') == U32.v pos' - U32.v pos )) (decreases (U32.v pos' - U32.v pos)) val serialized_list_length_constant_size (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p {k.parser_kind_high == Some k.parser_kind_low}) (l: list t) : Lemma (ensures ( serialized_list_length s l == L.length l `Prims.op_Multiply` k.parser_kind_low ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l1: Prims.list t -> l2: Prims.list t -> FStar.Pervasives.Lemma (ensures FStar.List.Tot.Base.length (l1 @ l2) == FStar.List.Tot.Base.length l1 + FStar.List.Tot.Base.length l2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.list", "FStar.List.Tot.Properties.append_length", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "Prims.int", "FStar.List.Tot.Base.length", "FStar.List.Tot.Base.append", "Prims.op_Addition", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let list_length_append (#t: Type) (l1 l2: list t) : Lemma (L.length (l1 `L.append` l2) == L.length l1 + L.length l2) =
L.append_length l1 l2
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.valid_list_frame_1
val valid_list_frame_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h s pos pos')) (ensures (valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos')) (decreases (U32.v pos' - U32.v pos))
val valid_list_frame_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h s pos pos')) (ensures (valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos')) (decreases (U32.v pos' - U32.v pos))
let rec valid_list_frame_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h s pos pos')) (ensures ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h s pos pos'; contents_list_eq p h s pos pos' ; valid_list_equiv p h' s pos pos' ; begin if pos = pos' then () else begin let pos1 = get_valid_pos p h s pos in valid_list_frame_1 p h s pos1 pos' l h' end end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h' s pos pos'
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 34, "end_line": 2034, "start_col": 0, "start_line": 2007 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' )))) let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos' val contents_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost (list t) (requires (valid_list p h sl pos pos')) (ensures (fun _ -> True)) (decreases (U32.v pos' - U32.v pos)) val contents_list_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (contents_list p h sl pos pos' == ( valid_list_equiv p h sl pos pos'; if pos = pos' then [] else contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' ))) let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_list p h sl pos pos /\ contents_list p h sl pos pos == [] )) = valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos let valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' )) (ensures ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' )) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( pos <> pos' /\ valid_list p h sl pos pos' )) (ensures ( pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos' ))) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: LowParse.Spec.Base.parser k t -> h: FStar.Monotonic.HyperStack.mem -> s: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> pos': FStar.UInt32.t -> l: LowStar.Monotonic.Buffer.loc -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires LowStar.Monotonic.Buffer.modifies l h h' /\ LowStar.Monotonic.Buffer.loc_disjoint l (LowParse.Slice.loc_slice_from_to s pos pos') /\ LowParse.Low.Base.Spec.valid_list p h s pos pos') (ensures LowParse.Low.Base.Spec.valid_list p h s pos pos' /\ LowParse.Low.Base.Spec.valid_list p h' s pos pos' /\ LowParse.Low.Base.Spec.contents_list p h' s pos pos' == LowParse.Low.Base.Spec.contents_list p h s pos pos') (decreases FStar.UInt32.v pos' - FStar.UInt32.v pos)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.slice", "FStar.UInt32.t", "LowStar.Monotonic.Buffer.loc", "LowParse.Low.Base.Spec.contents_list_eq", "Prims.unit", "LowStar.Monotonic.Buffer.modifies_buffer_from_to_elim", "LowParse.Slice.buffer_srel_of_srel", "LowParse.Slice.__proj__Mkslice__item__base", "Prims.op_Equality", "Prims.bool", "LowParse.Low.Base.Spec.valid_list_frame_1", "LowParse.Low.Base.Spec.get_valid_pos", "LowParse.Low.Base.Spec.valid_list_equiv", "Prims.l_and", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_disjoint", "LowParse.Slice.loc_slice_from_to", "LowParse.Low.Base.Spec.valid_list", "Prims.squash", "Prims.eq2", "Prims.list", "LowParse.Low.Base.Spec.contents_list", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "recursion" ]
false
false
true
false
false
let rec valid_list_frame_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h s pos pos')) (ensures (valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos')) (decreases (U32.v pos' - U32.v pos)) =
valid_list_equiv p h s pos pos'; contents_list_eq p h s pos pos'; valid_list_equiv p h' s pos pos'; if pos = pos' then () else (let pos1 = get_valid_pos p h s pos in valid_list_frame_1 p h s pos1 pos' l h'); B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h' s pos pos'
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.valid_list_cons
val valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos')) (ensures (valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos'))
val valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos')) (ensures (valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos'))
let valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' )) (ensures ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' )) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos'
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 34, "end_line": 1978, "start_col": 0, "start_line": 1957 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' )))) let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos' val contents_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost (list t) (requires (valid_list p h sl pos pos')) (ensures (fun _ -> True)) (decreases (U32.v pos' - U32.v pos)) val contents_list_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (contents_list p h sl pos pos' == ( valid_list_equiv p h sl pos pos'; if pos = pos' then [] else contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' ))) let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_list p h sl pos pos /\ contents_list p h sl pos pos == [] )) = valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: LowParse.Spec.Base.parser k t -> h: FStar.Monotonic.HyperStack.mem -> sl: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> pos': FStar.UInt32.t -> FStar.Pervasives.Lemma (requires LowParse.Low.Base.Spec.valid p h sl pos /\ LowParse.Low.Base.Spec.valid_list p h sl (LowParse.Low.Base.Spec.get_valid_pos p h sl pos) pos') (ensures LowParse.Low.Base.Spec.valid p h sl pos /\ LowParse.Low.Base.Spec.valid_list p h sl (LowParse.Low.Base.Spec.get_valid_pos p h sl pos) pos' /\ LowParse.Low.Base.Spec.valid_list p h sl pos pos' /\ LowParse.Low.Base.Spec.contents_list p h sl pos pos' == LowParse.Low.Base.Spec.contents p h sl pos :: LowParse.Low.Base.Spec.contents_list p h sl (LowParse.Low.Base.Spec.get_valid_pos p h sl pos) pos')
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.contents_list_eq", "Prims.unit", "LowParse.Low.Base.Spec.valid_list_equiv", "Prims.l_and", "LowParse.Low.Base.Spec.valid", "LowParse.Low.Base.Spec.valid_list", "LowParse.Low.Base.Spec.get_valid_pos", "Prims.squash", "Prims.eq2", "Prims.list", "LowParse.Low.Base.Spec.contents_list", "Prims.Cons", "LowParse.Low.Base.Spec.contents", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos')) (ensures (valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos')) =
valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos'
false
Steel.MonotonicReference.fst
Steel.MonotonicReference.witness
val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:erased (ref a p)) (fact:stable_property p) (v:erased a) (_:squash (fact v)) : SteelAtomicUT (witnessed r fact) inames (pts_to r q v) (fun _ -> pts_to r q v)
val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:erased (ref a p)) (fact:stable_property p) (v:erased a) (_:squash (fact v)) : SteelAtomicUT (witnessed r fact) inames (pts_to r q v) (fun _ -> pts_to r q v)
let witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:erased (ref a p)) (fact:stable_property p) (v:erased a) (_:squash (fact v)) = MHR.witness r (lift_property fact) (hide (U.raise_val (reveal v))) ()
{ "file_name": "lib/steel/Steel.MonotonicReference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 73, "end_line": 90, "start_col": 0, "start_line": 82 }
(* Copyright 2020 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 Steel.MonotonicReference open FStar.PCM open FStar.Ghost open Steel.FractionalPermission open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Preorder = FStar.Preorder module MHR = Steel.MonotonicHigherReference module U = FStar.Universe let raise_preorder (#a:Type0) (p:Preorder.preorder a) : Preorder.preorder (U.raise_t a) = fun (x0 x1:U.raise_t a) -> p (U.downgrade_val x0) (U.downgrade_val x1) let ref a p = MHR.ref (FStar.Universe.raise_t a) (raise_preorder p) /// The standard points to separation logic predicate let pts_to_sl (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:a) = MHR.pts_to_sl r f (hide (U.raise_val v)) /// Allocates a reference with value [x]. We have full permission on the newly /// allocated reference. let alloc (#a:Type) (p:Preorder.preorder a) (v:a) : SteelT (ref a p) emp (fun r -> pts_to r full_perm v) = let r = MHR.alloc (raise_preorder p) (U.raise_val v) in rewrite_slprop (MHR.pts_to r full_perm (hide (U.raise_val v))) (pts_to r full_perm v) (fun _ -> ()); return r /// Writes value [x] in the reference [r], as long as we have full ownership of [r] let write (#a:Type) (#p:Preorder.preorder a) (#v:erased a) (r:ref a p) (x:a) : Steel unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires fun _ -> p v x /\ True) (ensures fun _ _ _ -> True) = MHR.write r (U.raise_val x); rewrite_slprop (MHR.pts_to _ _ _) (pts_to r full_perm x) (fun _ -> ()) let lift_property (#a:Type u#0) (p:property a) : MHR.property (U.raise_t a) = fun x -> p (U.downgrade_val x) let witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a) = MHR.witnessed r (lift_property fact) /// If [fact] is a stable property for the reference preorder [p], and if
{ "checked_file": "/", "dependencies": [ "Steel.MonotonicHigherReference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.PCM.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Steel.MonotonicReference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.MonotonicHigherReference", "short_module": "MHR" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "FStar.PCM", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: FStar.Ghost.erased (Steel.MonotonicReference.ref a p) -> fact: Steel.MonotonicReference.stable_property p -> v: FStar.Ghost.erased a -> _: Prims.squash (fact (FStar.Ghost.reveal v)) -> Steel.Effect.Atomic.SteelAtomicUT (Steel.MonotonicReference.witnessed (FStar.Ghost.reveal r) fact)
Steel.Effect.Atomic.SteelAtomicUT
[]
[]
[ "Steel.Memory.inames", "Steel.FractionalPermission.perm", "FStar.Preorder.preorder", "FStar.Ghost.erased", "Steel.MonotonicReference.ref", "Steel.MonotonicReference.stable_property", "Prims.squash", "FStar.Ghost.reveal", "Steel.MonotonicHigherReference.witness", "FStar.Universe.raise_t", "Steel.MonotonicReference.raise_preorder", "Steel.MonotonicReference.lift_property", "FStar.Ghost.hide", "FStar.Universe.raise_val", "Steel.MonotonicHigherReference.witnessed", "Steel.MonotonicHigherReference.ref", "Steel.MonotonicReference.witnessed" ]
[]
false
true
false
false
false
let witness (#inames: _) (#a: Type) (#q: perm) (#p: Preorder.preorder a) (r: erased (ref a p)) (fact: stable_property p) (v: erased a) (_: squash (fact v)) =
MHR.witness r (lift_property fact) (hide (U.raise_val (reveal v))) ()
false
Steel.MonotonicReference.fst
Steel.MonotonicReference.recall
val recall (#inames: _) (#a:Type u#0) (#q:perm) (#p:Preorder.preorder a) (fact:property a) (r:erased (ref a p)) (v:erased a) (w:witnessed r fact) : SteelAtomicU unit inames (pts_to r q v) (fun _ -> pts_to r q v) (requires fun _ -> True) (ensures fun _ _ _ -> fact v)
val recall (#inames: _) (#a:Type u#0) (#q:perm) (#p:Preorder.preorder a) (fact:property a) (r:erased (ref a p)) (v:erased a) (w:witnessed r fact) : SteelAtomicU unit inames (pts_to r q v) (fun _ -> pts_to r q v) (requires fun _ -> True) (ensures fun _ _ _ -> fact v)
let recall (#inames: _) (#a:Type u#0) (#q:perm) (#p:Preorder.preorder a) (fact:property a) (r:erased (ref a p)) (v:erased a) (w:witnessed r fact) = MHR.recall (lift_property fact) r (hide (U.raise_val (reveal v))) w
{ "file_name": "lib/steel/Steel.MonotonicReference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 71, "end_line": 101, "start_col": 0, "start_line": 93 }
(* Copyright 2020 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 Steel.MonotonicReference open FStar.PCM open FStar.Ghost open Steel.FractionalPermission open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Preorder = FStar.Preorder module MHR = Steel.MonotonicHigherReference module U = FStar.Universe let raise_preorder (#a:Type0) (p:Preorder.preorder a) : Preorder.preorder (U.raise_t a) = fun (x0 x1:U.raise_t a) -> p (U.downgrade_val x0) (U.downgrade_val x1) let ref a p = MHR.ref (FStar.Universe.raise_t a) (raise_preorder p) /// The standard points to separation logic predicate let pts_to_sl (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:a) = MHR.pts_to_sl r f (hide (U.raise_val v)) /// Allocates a reference with value [x]. We have full permission on the newly /// allocated reference. let alloc (#a:Type) (p:Preorder.preorder a) (v:a) : SteelT (ref a p) emp (fun r -> pts_to r full_perm v) = let r = MHR.alloc (raise_preorder p) (U.raise_val v) in rewrite_slprop (MHR.pts_to r full_perm (hide (U.raise_val v))) (pts_to r full_perm v) (fun _ -> ()); return r /// Writes value [x] in the reference [r], as long as we have full ownership of [r] let write (#a:Type) (#p:Preorder.preorder a) (#v:erased a) (r:ref a p) (x:a) : Steel unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires fun _ -> p v x /\ True) (ensures fun _ _ _ -> True) = MHR.write r (U.raise_val x); rewrite_slprop (MHR.pts_to _ _ _) (pts_to r full_perm x) (fun _ -> ()) let lift_property (#a:Type u#0) (p:property a) : MHR.property (U.raise_t a) = fun x -> p (U.downgrade_val x) let witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a) = MHR.witnessed r (lift_property fact) /// If [fact] is a stable property for the reference preorder [p], and if /// it holds for the current value [v] of the reference, then we can witness it let witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:erased (ref a p)) (fact:stable_property p) (v:erased a) (_:squash (fact v)) = MHR.witness r (lift_property fact) (hide (U.raise_val (reveal v))) ()
{ "checked_file": "/", "dependencies": [ "Steel.MonotonicHigherReference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.PCM.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Steel.MonotonicReference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.MonotonicHigherReference", "short_module": "MHR" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "FStar.PCM", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
fact: Steel.MonotonicReference.property a -> r: FStar.Ghost.erased (Steel.MonotonicReference.ref a p) -> v: FStar.Ghost.erased a -> w: Steel.MonotonicReference.witnessed (FStar.Ghost.reveal r) fact -> Steel.Effect.Atomic.SteelAtomicU Prims.unit
Steel.Effect.Atomic.SteelAtomicU
[]
[]
[ "Steel.Memory.inames", "Steel.FractionalPermission.perm", "FStar.Preorder.preorder", "Steel.MonotonicReference.property", "FStar.Ghost.erased", "Steel.MonotonicReference.ref", "Steel.MonotonicReference.witnessed", "FStar.Ghost.reveal", "Steel.MonotonicHigherReference.recall", "FStar.Universe.raise_t", "Steel.MonotonicReference.raise_preorder", "Steel.MonotonicReference.lift_property", "FStar.Ghost.hide", "FStar.Universe.raise_val", "Prims.unit" ]
[]
false
true
false
false
false
let recall (#inames: _) (#a: Type u#0) (#q: perm) (#p: Preorder.preorder a) (fact: property a) (r: erased (ref a p)) (v: erased a) (w: witnessed r fact) =
MHR.recall (lift_property fact) r (hide (U.raise_val (reveal v))) w
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.valid_list_frame_2
val valid_list_frame_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h' s pos pos')) (ensures (valid_list p h' s pos pos' /\ valid_list p h s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos')) (decreases (U32.v pos' - U32.v pos))
val valid_list_frame_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h' s pos pos')) (ensures (valid_list p h' s pos pos' /\ valid_list p h s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos')) (decreases (U32.v pos' - U32.v pos))
let rec valid_list_frame_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h' s pos pos')) (ensures ( valid_list p h' s pos pos' /\ valid_list p h s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h' s pos pos' ; contents_list_eq p h' s pos pos' ; valid_list_equiv p h s pos pos' ; if pos = pos' then () else begin let pos1 = get_valid_pos p h' s pos in valid_valid_exact p h' s pos; valid_exact_valid p h s pos pos1; valid_list_frame_2 p h s pos1 pos' l h' end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h s pos pos'
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 33, "end_line": 2065, "start_col": 0, "start_line": 2036 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' )))) let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos' val contents_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost (list t) (requires (valid_list p h sl pos pos')) (ensures (fun _ -> True)) (decreases (U32.v pos' - U32.v pos)) val contents_list_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (contents_list p h sl pos pos' == ( valid_list_equiv p h sl pos pos'; if pos = pos' then [] else contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' ))) let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_list p h sl pos pos /\ contents_list p h sl pos pos == [] )) = valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos let valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' )) (ensures ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' )) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( pos <> pos' /\ valid_list p h sl pos pos' )) (ensures ( pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos' ))) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' let rec valid_list_frame_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h s pos pos')) (ensures ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h s pos pos'; contents_list_eq p h s pos pos' ; valid_list_equiv p h' s pos pos' ; begin if pos = pos' then () else begin let pos1 = get_valid_pos p h s pos in valid_list_frame_1 p h s pos1 pos' l h' end end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h' s pos pos'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: LowParse.Spec.Base.parser k t -> h: FStar.Monotonic.HyperStack.mem -> s: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> pos': FStar.UInt32.t -> l: LowStar.Monotonic.Buffer.loc -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires LowParse.Slice.live_slice h s /\ LowStar.Monotonic.Buffer.modifies l h h' /\ LowStar.Monotonic.Buffer.loc_disjoint l (LowParse.Slice.loc_slice_from_to s pos pos') /\ LowParse.Low.Base.Spec.valid_list p h' s pos pos') (ensures LowParse.Low.Base.Spec.valid_list p h' s pos pos' /\ LowParse.Low.Base.Spec.valid_list p h s pos pos' /\ LowParse.Low.Base.Spec.contents_list p h' s pos pos' == LowParse.Low.Base.Spec.contents_list p h s pos pos') (decreases FStar.UInt32.v pos' - FStar.UInt32.v pos)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.slice", "FStar.UInt32.t", "LowStar.Monotonic.Buffer.loc", "LowParse.Low.Base.Spec.contents_list_eq", "Prims.unit", "LowStar.Monotonic.Buffer.modifies_buffer_from_to_elim", "LowParse.Slice.buffer_srel_of_srel", "LowParse.Slice.__proj__Mkslice__item__base", "Prims.op_Equality", "Prims.bool", "LowParse.Low.Base.Spec.valid_list_frame_2", "LowParse.Low.Base.Spec.valid_exact_valid", "LowParse.Low.Base.Spec.valid_valid_exact", "LowParse.Low.Base.Spec.get_valid_pos", "LowParse.Low.Base.Spec.valid_list_equiv", "Prims.l_and", "LowParse.Slice.live_slice", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_disjoint", "LowParse.Slice.loc_slice_from_to", "LowParse.Low.Base.Spec.valid_list", "Prims.squash", "Prims.eq2", "Prims.list", "LowParse.Low.Base.Spec.contents_list", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "recursion" ]
false
false
true
false
false
let rec valid_list_frame_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h' s pos pos')) (ensures (valid_list p h' s pos pos' /\ valid_list p h s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos')) (decreases (U32.v pos' - U32.v pos)) =
valid_list_equiv p h' s pos pos'; contents_list_eq p h' s pos pos'; valid_list_equiv p h s pos pos'; if pos = pos' then () else (let pos1 = get_valid_pos p h' s pos in valid_valid_exact p h' s pos; valid_exact_valid p h s pos pos1; valid_list_frame_2 p h s pos1 pos' l h'); B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h s pos pos'
false
LowParse.Low.Base.Spec.fsti
LowParse.Low.Base.Spec.valid_list_frame
val valid_list_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ((valid_list p h s pos pos' \/ valid_list p h' s pos pos') ==> (valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos'))) [ SMTPatOr [ [SMTPat (valid_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_list p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h' s pos pos'); SMTPat (B.modifies l h h')] ] ]
val valid_list_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ((valid_list p h s pos pos' \/ valid_list p h' s pos pos') ==> (valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos'))) [ SMTPatOr [ [SMTPat (valid_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_list p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h' s pos pos'); SMTPat (B.modifies l h h')] ] ]
let valid_list_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_list p h s pos pos' \/ valid_list p h' s pos pos') ==> ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_list p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = Classical.move_requires (valid_list_frame_1 p h s pos pos' l) h'; Classical.move_requires (valid_list_frame_2 p h s pos pos' l) h'
{ "file_name": "src/lowparse/LowParse.Low.Base.Spec.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 66, "end_line": 2092, "start_col": 0, "start_line": 2067 }
module LowParse.Low.Base.Spec include LowParse.Spec.Base include LowParse.Slice module M = LowParse.Math module B = LowStar.Monotonic.Buffer module U32 = FStar.UInt32 module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module Seq = FStar.Seq let valid' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 = U32.v pos <= U32.v s.len /\ live_slice h s /\ Some? (parse p (bytes_of_slice_from h s pos)) val valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : GTot Type0 val valid_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (valid p h s pos <==> valid' p h s pos) val valid_dec (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost bool (requires (live_slice h s)) (ensures (fun b -> b == true <==> valid p h s pos )) let valid_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid' p h s pos)) // [SMTPat (valid p h s pos)] = valid_equiv p h s pos let valid_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (U32.v pos + k.parser_kind_low <= U32.v s.len /\ live_slice h s)) [SMTPat (valid p h s pos)] = parser_kind_prop_equiv k p; valid_equiv p h s pos let contents' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid' p h s pos)) (ensures (fun _ -> True)) = let Some (v, _) = parse p (bytes_of_slice_from h s pos) in v val contents (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Ghost t (requires (valid p h s pos)) (ensures (fun _ -> True)) val contents_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos)) (ensures (valid p h s pos /\ valid' p h s pos /\ contents p h s pos == contents' p h s pos)) let content_length' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid' p h sl pos)) (ensures (fun res -> U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) = let Some (_, consumed) = parse p (bytes_of_slice_from h sl pos) in parser_kind_prop_equiv k p; consumed val content_length (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost nat (requires (valid p h sl pos)) (ensures (fun res -> True)) val serialized_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Ghost nat (requires True) (ensures (fun res -> k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) val serialized_length_eq (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t) : Lemma (serialized_length s x == Seq.length (serialize s x)) val content_length_eq_gen (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (valid p h sl pos /\ valid' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos)) let content_length_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let res = content_length p h sl pos in U32.v pos + res <= U32.v sl.len /\ k.parser_kind_low <= res /\ ( match k.parser_kind_high with | None -> True | Some max -> res <= max ))) [SMTPat (content_length p h sl pos)] = content_length_eq_gen p h sl pos let valid_facts (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma ((valid p h sl pos <==> valid' p h sl pos) /\ (valid p h sl pos ==> ( contents p h sl pos == contents' p h sl pos /\ content_length p h sl pos == content_length' p h sl pos ))) = valid_equiv p h sl pos; Classical.move_requires (contents_eq p h sl) pos; Classical.move_requires (content_length_eq_gen p h sl) pos val content_length_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures (content_length p h sl pos == serialized_length s (contents p h sl pos))) [SMTPat (serialized_length s (contents p h sl pos))] let valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) = valid p h sl pos /\ U32.v pos + content_length p h sl pos == U32.v pos' val get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires (valid p h sl pos)) (ensures (fun pos' -> True)) val get_valid_pos_post (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h sl pos)) (ensures ( let pos' = get_valid_pos p h sl pos in valid_pos p h sl pos pos' )) [SMTPat (get_valid_pos p h sl pos)] let valid_pos_get_valid_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h sl pos pos')) (ensures (get_valid_pos p h sl pos == pos')) [SMTPat (valid_pos p h sl pos pos'); SMTPat (get_valid_pos p h sl pos)] = () let valid_pos_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p h sl pos /\ k.parser_kind_subkind == Some ParserConsumesAll )) (ensures ( valid_pos p h sl pos sl.len )) = parser_kind_prop_equiv k p; valid_facts p h sl pos let valid_content (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) = valid p h sl pos /\ contents p h sl pos == x let valid_content_pos (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (x: t) (pos' : U32.t) = valid_pos p h sl pos pos' /\ valid_content p h sl pos x let valid_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from sl pos) l)) (ensures ( (valid p h sl pos \/ valid p h' sl pos) ==> ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) ))) [SMTPatOr [ [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires (U32.v pos <= U32.v sl.len /\ (valid p h sl pos \/ valid p h' sl pos))) (ensures ( valid p h sl pos /\ valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) = B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'; valid_facts p h sl pos; valid_facts p h' sl pos in Classical.move_requires f () (* Case where we do not have the strong prefix property (e.g. lists): we need an extra length *) let bytes_of_slice_from_to (#rrel #rel: _) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) : Ghost bytes (requires (U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len)) (ensures (fun _ -> True)) = Seq.slice (B.as_seq h s.base) (U32.v pos) (U32.v pos') let valid_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 = U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ live_slice h s /\ ( let len' = pos' `U32.sub` pos in match parse p (bytes_of_slice_from_to h s pos pos') with | None -> False | Some (_, consumed) -> (consumed <: nat) == U32.v len' ) val valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 val valid_exact_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_exact p h s pos pos' <==> valid_exact' p h s pos pos') let valid_exact_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact' p h s pos pos')) // [SMTPat (valid_exact p h s pos pos')] = valid_exact_equiv p h s pos pos' let valid_exact_elim' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures ( live_slice h s /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ ( let length = U32.v pos' - U32.v pos in k.parser_kind_low <= length /\ ( match k.parser_kind_high with | Some high -> length <= high | _ -> True )))) [SMTPat (valid_exact p h s pos pos')] = parser_kind_prop_equiv k p; valid_exact_equiv p h s pos pos' let contents_exact' (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact' p h s pos pos')) (ensures (fun _ -> True)) = let (Some (v, _)) = parse p (bytes_of_slice_from_to h s pos pos') in v val contents_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost t (requires (valid_exact p h s pos pos')) (ensures (fun _ -> True)) val contents_exact_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos')) (ensures (valid_exact p h s pos pos' /\ valid_exact' p h s pos pos' /\ contents_exact p h s pos pos' == contents_exact' p h s pos pos')) let valid_exact_serialize (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h sl pos pos')) (ensures ( serialize s (contents_exact p h sl pos pos') == bytes_of_slice_from_to h sl pos pos' )) = valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' ; serializer_correct_implies_complete p s; () let serialize_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (h: HS.mem) (sl: slice rrel rel) (x: t) (pos: U32.t) (pos' : U32.t) : Lemma (requires ( live_slice h sl /\ U32.v pos + Seq.length (serialize s x) == U32.v pos' /\ U32.v pos' <= U32.v sl.len /\ bytes_of_slice_from_to h sl pos pos' `Seq.equal` serialize s x )) (ensures ( valid_exact p h sl pos pos' /\ contents_exact p h sl pos pos' == x )) = serializer_correct_implies_complete p s; valid_exact_equiv p h sl pos pos' ; contents_exact_eq p h sl pos pos' let valid_exact_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ( (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') ==> ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' ))) [SMTPatOr [ [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]; ]] = let f () : Lemma (requires ( U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v s.len /\ (valid_exact p h s pos pos' \/ valid_exact p h' s pos pos') )) (ensures ( valid_exact p h s pos pos' /\ valid_exact p h' s pos pos' /\ contents_exact p h' s pos pos' == contents_exact p h s pos pos' )) = valid_exact_equiv p h s pos pos' ; valid_exact_equiv p h' s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; Classical.move_requires (contents_exact_eq p h' s pos) pos' ; B.modifies_buffer_from_to_elim s.base pos pos' l h h' in Classical.move_requires f () let valid_valid_exact_consumes_all (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserConsumesAll)) (ensures ( (valid p h s pos \/ valid_exact p h s pos s.len) ==> (valid_exact p h s pos s.len /\ valid_content_pos p h s pos (contents_exact p h s pos s.len) s.len) )) = parser_kind_prop_equiv k p; valid_facts p h s pos; valid_exact_equiv p h s pos s.len; Classical.move_requires (contents_exact_eq p h s pos) s.len let valid_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) : Lemma (requires (valid p h s pos /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( let npos' = U32.v pos + content_length p h s pos in npos' <= U32.v s.len /\ ( let pos' = U32.uint_to_t npos' in valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos ))) = valid_facts p h s pos; let npos' = U32.v pos + content_length p h s pos in let pos' = U32.uint_to_t npos' in valid_exact_equiv p h s pos pos' ; Classical.move_requires (contents_exact_eq p h s pos) pos' ; parse_strong_prefix p (bytes_of_slice_from h s pos) (bytes_of_slice_from_to h s pos pos') let valid_pos_valid_exact (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) = valid_valid_exact p h s pos let valid_pos_valid_exact_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_pos p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_exact p h s pos pos' /\ contents_exact p h s pos pos' == contents p h s pos )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_pos_valid_exact p h s pos pos' let valid_exact_valid (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) = valid_exact_equiv p h s pos pos' ; contents_exact_eq p h s pos pos' ; valid_facts p h s pos; parse_strong_prefix p (bytes_of_slice_from_to h s pos pos') (bytes_of_slice_from h s pos) let valid_exact_valid_pat (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_exact p h s pos pos' /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h s pos (contents_exact p h s pos pos') pos' )) [SMTPat (valid_exact p h s pos pos'); SMTPat (valid p h s pos)] = valid_exact_valid p h s pos pos' let valid_pos_frame_strong_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( valid_pos p h sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' )) = valid_pos_valid_exact p h sl pos pos'; valid_exact_valid p h' sl pos pos' let valid_pos_frame_strong_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid_pos p h' sl pos pos' /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_pos p h sl pos pos' /\ valid_pos p h' sl pos pos' /\ valid_content_pos p h sl pos (contents p h' sl pos) pos' )) = valid_pos_valid_exact p h' sl pos pos'; valid_exact_valid p h sl pos pos' let valid_pos_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos pos') l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( (valid_pos p h sl pos pos' \/ valid_pos p h' sl pos pos') ==> ( valid_pos p h sl pos pos' /\ valid_content_pos p h' sl pos (contents p h sl pos) pos' ))) = Classical.move_requires (valid_pos_frame_strong_1 p h sl pos pos' l) h'; Classical.move_requires (valid_pos_frame_strong_2 p h sl pos pos' l) h' let valid_frame_strong (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires ( live_slice h sl /\ valid p h sl pos /\ B.modifies l h h' /\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos) )) [SMTPatOr [ // [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')]; [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')]; [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]; ]] = valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h' let valid_exact_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ live_slice h2 s2 /\ U32.v pos1' - U32.v pos1 == U32.v pos2' - U32.v pos2 /\ U32.v pos2' <= U32.v s2.len /\ bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )) (ensures ( valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h2 s2 pos2 pos2' == contents_exact p h1 s1 pos1 pos1' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' let valid_exact_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (pos1' : U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) (pos2' : U32.t) : Lemma (requires ( valid_exact p h1 s1 pos1 pos1' /\ valid_exact p h2 s2 pos2 pos2' /\ contents_exact p h1 s1 pos1 pos1' == contents_exact p h2 s2 pos2 pos2' )) (ensures ( U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = valid_exact_equiv p h1 s1 pos1 pos1' ; valid_exact_equiv p h2 s2 pos2 pos2' ; contents_exact_eq p h1 s1 pos1 pos1' ; contents_exact_eq p h2 s2 pos2 pos2' ; parser_kind_prop_equiv k p; assert (injective_precond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')); assert (injective_postcond p (bytes_of_slice_from_to h1 s1 pos1 pos1') (bytes_of_slice_from_to h2 s2 pos2 pos2')) let valid_ext_intro (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ k.parser_kind_subkind == Some ParserStrong /\ ( let pos1' = get_valid_pos p h1 s1 pos1 in live_slice h2 s2 /\ U32.v pos2 + (U32.v pos1' - U32.v pos1) <= U32.v s2.len /\ ( let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in bytes_of_slice_from_to h1 s1 pos1 pos1' `Seq.equal` bytes_of_slice_from_to h2 s2 pos2 pos2' )))) (ensures ( valid_content_pos p h2 s2 pos2 (contents p h1 s1 pos1) (pos2 `U32.add` (get_valid_pos p h1 s1 pos1 `U32.sub` pos1)) )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = pos2 `U32.add` (pos1' `U32.sub` pos1) in valid_pos_valid_exact p h1 s1 pos1 pos1' ; valid_exact_ext_intro p h1 s1 pos1 pos1' h2 s2 pos2 pos2' ; valid_exact_valid p h2 s2 pos2 pos2' let valid_ext_elim (#rrel1 #rel1: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h1: HS.mem) (s1: slice rrel1 rel1) (pos1: U32.t) (h2: HS.mem) (#rrel2 #rel2: _) (s2: slice rrel2 rel2) (pos2: U32.t) : Lemma (requires ( valid p h1 s1 pos1 /\ valid p h2 s2 pos2 /\ k.parser_kind_subkind == Some ParserStrong /\ contents p h1 s1 pos1 == contents p h2 s2 pos2 )) (ensures ( let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in U32.v pos2' - U32.v pos2 == U32.v pos1' - U32.v pos1 /\ bytes_of_slice_from_to h1 s1 pos1 pos1' == bytes_of_slice_from_to h2 s2 pos2 pos2' )) = let pos1' = get_valid_pos p h1 s1 pos1 in let pos2' = get_valid_pos p h2 s2 pos2 in valid_valid_exact p h1 s1 pos1; valid_valid_exact p h2 s2 pos2; valid_exact_ext_elim p h1 s1 pos1 pos1' h2 s2 pos2 pos2' (* Accessors for reading only (no in-place serialization yet) *) noeq type clens (t1: Type) (t2: Type) = { clens_cond: t1 -> GTot Type0; clens_get: (x1: t1) -> Ghost t2 (requires (clens_cond x1)) (ensures (fun _ -> True)); (* clens_put: (x1: t1) -> t2 -> Ghost t1 (requires (clens_cond x1)) (ensures (fun x1' -> clens_cond x1')); clens_get_put: (x1: t1) -> (x2: t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_get (clens_put x1 x2) == x2)); clens_put_put: (x1: t1) -> (x2: t2) -> (x2' : t2) -> Lemma (requires (clens_cond x1)) (ensures (clens_put (clens_put x1 x2) x2' == clens_put x1 x2')); clens_put_get: (x1: t1) -> Lemma (requires (clens_cond x1)) (ensures (clens_put x1 (clens_get x1) == x1)); *) } let clens_id (t: Type) : Tot (clens t t) = { clens_cond = (fun _ -> True); clens_get = (fun x -> x); } let clens_eq (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') : GTot Type0 = (forall (x: t) . {:pattern (cl1.clens_cond x) \/ (cl2.clens_cond x)} cl1.clens_cond x <==> cl2.clens_cond x) /\ (forall (x: t) . {:pattern (cl1.clens_get x) \/ (cl2.clens_get x)} (cl1.clens_cond x \/ cl2.clens_cond x) ==> (cl1.clens_get x == cl2.clens_get x)) let clens_eq_intro (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Lemma (cl1.clens_cond x <==> cl2.clens_cond x) )) (get: ( (x: t) -> Lemma (requires (cl1.clens_cond x /\ cl2.clens_cond x)) (ensures (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Lemma (clens_eq cl1 cl2) = Classical.forall_intro cond; Classical.forall_intro (Classical.move_requires get) let clens_eq_intro' (#t: Type) (#t': Type) (cl1: clens t t') (cl2: clens t t') (cond: ( (x: t) -> Tot (squash (cl1.clens_cond x <==> cl2.clens_cond x)) )) (get: ( (x: t) -> (sq: squash (cl1.clens_cond x /\ cl2.clens_cond x)) -> Tot (squash (cl1.clens_cond x /\ cl2.clens_cond x /\ cl1.clens_get x == cl2.clens_get x)) )) : Tot (squash (clens_eq cl1 cl2)) = clens_eq_intro cl1 cl2 (fun x -> cond x) (fun x -> get x ()) (* let clens_get_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_get (l.clens_put x1 x2) == x2)) [SMTPat (l.clens_get (l.clens_put x1 x2))] = l.clens_get_put x1 x2 let clens_put_put' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) (x2: t2) (x2' : t2) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put (l.clens_put x1 x2) x2' == l.clens_put x1 x2')) [SMTPat (l.clens_put (l.clens_put x1 x2) x2')] = l.clens_put_put x1 x2 x2' let clens_put_get' (#t1: Type) (#clens_cond: t1 -> GTot Type0) (#t2: Type) (l: clens clens_cond t2) (x1: t1) : Lemma (requires (clens_cond x1)) (ensures (l.clens_put x1 (l.clens_get x1) == x1)) [SMTPat (l.clens_put x1 (l.clens_get x1))] = l.clens_put_get x1 abstract let clens_disjoint_l (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = (forall (x0: t0) (x2: t2) . (clens_cond2 x0 /\ clens_cond3 x0) ==> (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) abstract let clens_disjoint_l_elim (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (x0: t0) (x2: t2) : Lemma (requires (clens_disjoint_l l2 l3 /\ clens_cond2 x0 /\ clens_cond3 x0)) (ensures (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)) [SMTPat (l3.clens_get (l2.clens_put x0 x2))] = () abstract let clens_disjoint_l_intro (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (lem: ( (x0: t0) -> (x2: t2) -> Lemma (requires (clens_cond2 x0 /\ clens_cond3 x0)) (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0))) )) : Lemma (clens_disjoint_l l2 l3) = let lem' (x0: t0) (x2: t2) : Lemma ((clens_cond2 x0 /\ clens_cond3 x0) ==> (ensures (clens_cond2 x0 /\ clens_cond3 x0 /\ (let x0' = l2.clens_put x0 x2 in clens_cond3 x0' /\ l3.clens_get x0' == l3.clens_get x0)))) = Classical.move_requires (lem x0) x2 in Classical.forall_intro_2 lem' let clens_disjoint (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : GTot Type0 = clens_disjoint_l l2 l3 /\ clens_disjoint_l l3 l2 let clens_disjoint_sym (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) : Lemma (clens_disjoint l2 l3 <==> clens_disjoint l3 l2) [SMTPat (clens_disjoint l2 l3)] = () *) let clens_compose_cond (#t1: Type) (#t2: Type) (l12: clens t1 t2) (clens_cond2: t2 -> GTot Type0) (x1: t1) : GTot Type0 = l12.clens_cond x1 /\ clens_cond2 (l12.clens_get x1) let clens_compose (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : Tot (clens t1 t3) = { clens_cond = (clens_compose_cond l12 l23.clens_cond); clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); (* clens_put = (fun x1 x3 -> let x2' = l23.clens_put (l12.clens_get x1) x3 in let x1' = l12.clens_put x1 x2' in x1' ); clens_get_put = (fun x1 x3 -> ()); clens_put_put = (fun x1 x3 x3' -> ()); clens_put_get = (fun x1 -> ()); *) } let clens_compose_strong_pre (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3) : GTot Type0 = forall (x: t1) . {:pattern (l12.clens_cond x) \/ (l23.clens_cond (l12.clens_get x))} l12.clens_cond x ==> l23.clens_cond (l12.clens_get x) let clens_compose_strong (#t1: Type) (#t2: Type) (#t3: Type) (l12: clens t1 t2) (l23: clens t2 t3 { clens_compose_strong_pre l12 l23 }) : Tot (clens t1 t3) = { clens_cond = l12.clens_cond; clens_get = (fun x1 -> l23.clens_get (l12.clens_get x1)); } (* abstract let clens_disjoint_compose (#t0: Type) (#clens_cond2: t0 -> GTot Type0) (#clens_cond3: t0 -> GTot Type0) (#t2 #t3: Type) (l2: clens clens_cond2 t2) (l3: clens clens_cond3 t3) (#clens_cond3': t3 -> GTot Type0) (#t3' : Type) (l3' : clens clens_cond3' t3') : Lemma (requires (clens_disjoint l2 l3)) (ensures (clens_disjoint l2 (clens_compose l3 l3'))) [SMTPat (clens_disjoint l2 (clens_compose l3 l3'))] = () *) let gaccessor_pre (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) : GTot Type0 = match parse p1 sl with | Some (x1, _) -> cl.clens_cond x1 | _ -> False let gaccessor_post (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl: bytes) (res : nat) : GTot Type0 = res <= Seq.length sl /\ begin match parse p1 sl with | Some (x1, consumed1) -> begin match parse p2 (Seq.slice sl res (Seq.length sl)) with | Some (x2, consumed2) -> cl.clens_cond x1 /\ x2 == cl.clens_get x1 /\ res + consumed2 <= consumed1 | _ -> False end | _ -> False end let gaccessor_post' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (sl : bytes) (res: nat) : GTot Type0 = res <= Seq.length sl /\ (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res) let gaccessor' (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (sl: bytes) -> Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl sl res )) let gaccessor_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (k1.parser_kind_subkind == Some ParserStrong ==> (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ no_lookahead_on_precond p1 sl sl') ==> f sl == f sl')) let gaccessor_no_lookahead_weaken (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) (sl sl' : bytes) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p2 cl sl /\ no_lookahead_on_precond p1 sl sl' )) (ensures (gaccessor_pre p1 p2 cl sl')) = parse_strong_prefix p1 sl sl' let gaccessor_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) = (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\ gaccessor_pre p1 p2 cl sl' /\ injective_precond p1 sl sl') ==> f sl == f sl') let gaccessor_prop' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 = gaccessor_no_lookahead f /\ gaccessor_injective f val gaccessor_prop (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : GTot Type0 val gaccessor_prop_equiv (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) (f: gaccessor' p1 p2 cl) : Lemma (gaccessor_prop f <==> gaccessor_prop' f) [@unifier_hint_injective] let gaccessor (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (cl: clens t1 t2) : Tot Type = (f: gaccessor' p1 p2 cl { gaccessor_prop f }) let get_gaccessor_clens (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) : Tot (clens t1 t2) = cl (* abstract let gaccessors_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) : GTot Type0 = // clens_disjoint cl2 cl3 /\ (forall (sl: bytes) . ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) *) (* abstract let gaccessors_disjoint_clens_disjoint (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#pre2: t1 -> GTot Type0) (#cl2: clens pre2 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#pre3: t1 -> GTot Type0) (#cl3: clens pre3 t3) (g3: gaccessor p1 p3 cl3) : Lemma (requires (gaccessors_disjoint g2 g3)) (ensures (clens_disjoint cl2 cl3)) [SMTPat (gaccessors_disjoint g2 g3)] = () *) (* abstract let gaccessors_disjoint_elim (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) (sl: bytes) : Lemma (requires (gaccessors_disjoint g2 g3 /\ ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ))) (ensures ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = () abstract let gaccessors_disjoint_intro (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl2: clens t1 t2) (g2: gaccessor p1 p2 cl2) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl3: clens t1 t3) (g3: gaccessor p1 p3 cl3) // (clens_disj: squash (clens_disjoint cl2 cl3)) (lem: ( (sl: bytes) -> Lemma (requires ( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False )) (ensures (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False) /\ ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 ))) )) : Lemma (gaccessors_disjoint g2 g3) = let lem' (sl: bytes) : Lemma (( match parse p1 sl with | Some (x1, consumed1) -> cl2.clens_cond x1 /\ cl3.clens_cond x1 /\ consumed1 == Seq.length sl | _ -> False ) ==> ( let (pos2, consumed2) = g2 sl in let (pos3, consumed3) = g3 sl in pos2 + consumed2 <= pos3 \/ pos3 + consumed3 <= pos2 )) = Classical.move_requires lem sl in Classical.forall_intro lem' *) let gaccessor_id' (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p p (clens_id _) input res)) = 0 val gaccessor_id (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (gaccessor p p (clens_id _)) val gaccessor_id_eq (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (gaccessor_id p input == gaccessor_id' p input) let gaccessor_ext' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p2 cl' input res)) = g input val gaccessor_ext (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) : Tot (gaccessor p1 p2 cl') val gaccessor_ext_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (cl': clens t1 t2) (sq: squash (clens_eq cl cl')) (input: bytes) : Lemma (gaccessor_ext g cl' sq input == gaccessor_ext' g cl' sq input) let gaccessor_compose' (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Ghost (nat) (requires True) (ensures (fun res -> gaccessor_post' p1 p3 (clens_compose cl12 cl23) input res)) = let pos2 = a12 input in let input2 = Seq.slice input pos2 (Seq.length input) in let pos3 = a23 input2 in pos2 + pos3 val gaccessor_compose_injective (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ injective_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose_no_lookahead (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (sl sl': bytes) : Lemma (requires (k1.parser_kind_subkind == Some ParserStrong /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl /\ gaccessor_pre p1 p3 (clens_compose cl12 cl23) sl' /\ no_lookahead_on_precond p1 sl sl')) (ensures (gaccessor_compose' a12 a23 sl == gaccessor_compose' a12 a23 sl')) val gaccessor_compose (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) : Tot (gaccessor p1 p3 (clens_compose cl12 cl23)) val gaccessor_compose_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23) (input: bytes) : Lemma (gaccessor_compose a12 a23 input == gaccessor_compose' a12 a23 input) (* abstract let gaccessor_compose_strong (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) : Tot (gaccessor p1 p3 (clens_compose_strong cl12 cl23)) = gaccessor_compose' a12 a23 abstract let gaccessor_compose_strong_eq (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl12: clens t1 t2) (a12: gaccessor p1 p2 cl12) (#k3: parser_kind) (#t3: Type) (#p3: parser k3 t3) (#cl23: clens t2 t3) (a23: gaccessor p2 p3 cl23 { clens_compose_strong_pre cl12 cl23 } ) (input: bytes) : Lemma (gaccessor_compose_strong a12 a23 input == gaccessor_compose' a12 a23 input) = () *) let slice_access' (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos )) (ensures (fun pos' -> True)) = let small = bytes_of_slice_from h sl pos in pos `U32.add` U32.uint_to_t (g small) val slice_access (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Ghost U32.t (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures (fun pos' -> True)) val slice_access_eq (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( valid' p1 h sl pos /\ cl.clens_cond (contents' p1 h sl pos) /\ slice_access h g sl pos == slice_access' h g sl pos )) let slice_access_post (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) )) (ensures ( let pos' = slice_access h g sl pos in valid p2 h sl pos' /\ contents p2 h sl pos' == cl.clens_get (contents p1 h sl pos) /\ // useful for framing U32.v pos <= U32.v pos' /\ U32.v pos' + content_length p2 h sl pos' <= U32.v pos + content_length p1 h sl pos )) [SMTPat (slice_access h g sl pos)] = slice_access_eq h g sl pos; valid_facts p1 h sl pos; assert_norm (pow2 32 == 4294967296); let res = slice_access' h g sl pos in valid_facts p2 h sl res let slice_access_frame_weak (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from sl pos) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] = valid_facts p1 h sl pos; valid_facts p1 h' sl pos; slice_access_eq h g sl pos; slice_access_eq h' g sl pos; B.modifies_buffer_from_to_elim sl.base pos sl.len l h h' val slice_access_frame_strong (#rrel #rel: _) (h: HS.mem) (#k1: parser_kind) (#t1: Type) (#p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (#p2: parser k2 t2) (#cl: clens t1 t2) (g: gaccessor p1 p2 cl) (sl: slice rrel rel) (pos: U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires ( k1.parser_kind_subkind == Some ParserStrong /\ valid p1 h sl pos /\ cl.clens_cond (contents p1 h sl pos) /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos)) )) (ensures ( valid p1 h' sl pos /\ cl.clens_cond (contents p1 h' sl pos) /\ slice_access h' g sl pos == slice_access h g sl pos )) [SMTPatOr [ [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')]; [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]; ]] (* lists, to avoid putting LowParse.*.List into the user context *) val valid_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : GTot Type0 (decreases (U32.v pos' - U32.v pos)) val valid_list_equiv (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (valid_list p h sl pos pos' <==> ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos' <= U32.v sl.len /\ ( if pos = pos' then True else valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in U32.v pos1 <= U32.v pos' /\ valid_list p h sl pos1 pos' )))) let valid_list_elim (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ live_slice h sl /\ U32.v pos <= U32.v pos' /\ U32.v pos' <= U32.v sl.len )) [SMTPat (valid_list p h sl pos pos')] = valid_list_equiv p h sl pos pos' val contents_list (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Ghost (list t) (requires (valid_list p h sl pos pos')) (ensures (fun _ -> True)) (decreases (U32.v pos' - U32.v pos)) val contents_list_eq (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos: U32.t) (pos' : U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (contents_list p h sl pos pos' == ( valid_list_equiv p h sl pos pos'; if pos = pos' then [] else contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' ))) let valid_list_nil (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl /\ k.parser_kind_low > 0 /\ k.parser_kind_subkind == Some ParserStrong)) (ensures ( valid_list p h sl pos pos /\ contents_list p h sl pos pos == [] )) = valid_list_equiv p h sl pos pos; contents_list_eq p h sl pos pos let valid_list_cons (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' )) (ensures ( valid p h sl pos /\ valid_list p h sl (get_valid_pos p h sl pos) pos' /\ valid_list p h sl pos pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl (get_valid_pos p h sl pos) pos' )) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let valid_list_cons_recip (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( pos <> pos' /\ valid_list p h sl pos pos' )) (ensures ( pos <> pos' /\ valid_list p h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_list p h sl pos1 pos' /\ contents_list p h sl pos pos' == contents p h sl pos :: contents_list p h sl pos1 pos' ))) = valid_list_equiv p h sl pos pos' ; contents_list_eq p h sl pos pos' let rec valid_list_frame_1 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h s pos pos')) (ensures ( valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h s pos pos'; contents_list_eq p h s pos pos' ; valid_list_equiv p h' s pos pos' ; begin if pos = pos' then () else begin let pos1 = get_valid_pos p h s pos in valid_list_frame_1 p h s pos1 pos' l h' end end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h' s pos pos' let rec valid_list_frame_2 (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos: U32.t) (pos' : U32.t) (l: B.loc) (h' : HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\ valid_list p h' s pos pos')) (ensures ( valid_list p h' s pos pos' /\ valid_list p h s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h' s pos pos' ; contents_list_eq p h' s pos pos' ; valid_list_equiv p h s pos pos' ; if pos = pos' then () else begin let pos1 = get_valid_pos p h' s pos in valid_valid_exact p h' s pos; valid_exact_valid p h s pos pos1; valid_list_frame_2 p h s pos1 pos' l h' end; B.modifies_buffer_from_to_elim s.base pos pos' l h h'; contents_list_eq p h s pos pos'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "LowParse.Spec.Base.fsti.checked", "LowParse.Slice.fst.checked", "LowParse.Math.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Low.Base.Spec.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Monotonic.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowParse.Math", "short_module": "M" }, { "abbrev": false, "full_module": "LowParse.Slice", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: LowParse.Spec.Base.parser k t -> h: FStar.Monotonic.HyperStack.mem -> s: LowParse.Slice.slice rrel rel -> pos: FStar.UInt32.t -> pos': FStar.UInt32.t -> l: LowStar.Monotonic.Buffer.loc -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires LowParse.Slice.live_slice h s /\ LowStar.Monotonic.Buffer.modifies l h h' /\ LowStar.Monotonic.Buffer.loc_disjoint l (LowParse.Slice.loc_slice_from_to s pos pos')) (ensures LowParse.Low.Base.Spec.valid_list p h s pos pos' \/ LowParse.Low.Base.Spec.valid_list p h' s pos pos' ==> LowParse.Low.Base.Spec.valid_list p h s pos pos' /\ LowParse.Low.Base.Spec.valid_list p h' s pos pos' /\ LowParse.Low.Base.Spec.contents_list p h' s pos pos' == LowParse.Low.Base.Spec.contents_list p h s pos pos') [ SMTPatOr [ [ SMTPat (LowParse.Low.Base.Spec.valid_list p h s pos pos'); SMTPat (LowStar.Monotonic.Buffer.modifies l h h') ]; [ SMTPat (LowParse.Low.Base.Spec.valid_list p h' s pos pos'); SMTPat (LowStar.Monotonic.Buffer.modifies l h h') ]; [ SMTPat (LowParse.Low.Base.Spec.contents_list p h s pos pos'); SMTPat (LowStar.Monotonic.Buffer.modifies l h h') ]; [ SMTPat (LowParse.Low.Base.Spec.contents_list p h' s pos pos'); SMTPat (LowStar.Monotonic.Buffer.modifies l h h') ] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.slice", "FStar.UInt32.t", "LowStar.Monotonic.Buffer.loc", "FStar.Classical.move_requires", "Prims.l_and", "LowParse.Slice.live_slice", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_disjoint", "LowParse.Slice.loc_slice_from_to", "LowParse.Low.Base.Spec.valid_list", "Prims.eq2", "Prims.list", "LowParse.Low.Base.Spec.contents_list", "LowParse.Low.Base.Spec.valid_list_frame_2", "Prims.unit", "LowParse.Low.Base.Spec.valid_list_frame_1", "Prims.squash", "Prims.l_imp", "Prims.l_or", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat_or", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
false
false
true
false
false
let valid_list_frame (#rrel #rel: _) (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (s: slice rrel rel) (pos pos': U32.t) (l: B.loc) (h': HS.mem) : Lemma (requires (live_slice h s /\ B.modifies l h h' /\ B.loc_disjoint l (loc_slice_from_to s pos pos'))) (ensures ((valid_list p h s pos pos' \/ valid_list p h' s pos pos') ==> (valid_list p h s pos pos' /\ valid_list p h' s pos pos' /\ contents_list p h' s pos pos' == contents_list p h s pos pos'))) [ SMTPatOr [ [SMTPat (valid_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (valid_list p h' s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h s pos pos'); SMTPat (B.modifies l h h')]; [SMTPat (contents_list p h' s pos pos'); SMTPat (B.modifies l h h')] ] ] =
Classical.move_requires (valid_list_frame_1 p h s pos pos' l) h'; Classical.move_requires (valid_list_frame_2 p h s pos pos' l) h'
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.eval_vec
val eval_vec (v: vec) (s: state) : quad32
val eval_vec (v: vec) (s: state) : quad32
let eval_vec (v:vec) (s:state) : quad32 = s.vecs v
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 57, "end_line": 21, "start_col": 7, "start_line": 21 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
v: Vale.PPC64LE.Machine_s.vec -> s: Vale.PPC64LE.State.state -> Vale.PPC64LE.Machine_s.quad32
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.vec", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs", "Vale.PPC64LE.Machine_s.quad32" ]
[]
false
false
false
true
false
let eval_vec (v: vec) (s: state) : quad32 =
s.vecs v
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.eval_maddr
val eval_maddr (m: maddr) (s: state) : int
val eval_maddr (m: maddr) (s: state) : int
let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 27, "start_col": 0, "start_line": 26 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Vale.PPC64LE.Machine_s.maddr -> s: Vale.PPC64LE.State.state -> Prims.int
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.maddr", "Vale.PPC64LE.State.state", "Prims.op_Addition", "Vale.PPC64LE.State.eval_reg", "Vale.PPC64LE.Machine_s.__proj__Mkmaddr__item__address", "Vale.PPC64LE.Machine_s.__proj__Mkmaddr__item__offset", "Prims.int" ]
[]
false
false
false
true
false
let eval_maddr (m: maddr) (s: state) : int =
eval_reg m.address s + m.offset
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.eval_reg
val eval_reg (r: reg) (s: state) : nat64
val eval_reg (r: reg) (s: state) : nat64
let eval_reg (r:reg) (s:state) : nat64 = s.regs r
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 56, "end_line": 19, "start_col": 7, "start_line": 19 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: Vale.PPC64LE.Machine_s.reg -> s: Vale.PPC64LE.State.state -> Vale.PPC64LE.Machine_s.nat64
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.reg", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs", "Vale.PPC64LE.Machine_s.nat64" ]
[]
false
false
false
true
false
let eval_reg (r: reg) (s: state) : nat64 =
s.regs r
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.eval_stack
val eval_stack (ptr: int) (s: state) : GTot nat64
val eval_stack (ptr: int) (s: state) : GTot nat64
let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack)
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 103, "end_line": 36, "start_col": 7, "start_line": 36 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> s: Vale.PPC64LE.State.state -> Prims.GTot Vale.PPC64LE.Machine_s.nat64
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Stack_i.load_stack64", "Vale.PPC64LE.Stack_Sems.stack_from_s", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.PPC64LE.Machine_s.nat64" ]
[]
false
false
false
false
false
let eval_stack (ptr: int) (s: state) : GTot nat64 =
load_stack64 ptr (VSS.stack_from_s s.ms_stack)
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.update_stack64
val update_stack64 (ptr: int) (v: nat64) (s: state) : GTot state
val update_stack64 (ptr: int) (v: nat64) (s: state) : GTot state
let update_stack64 (ptr:int) (v:nat64) (s:state) : GTot state = {s with ms_stack = VSS.stack_to_s (store_stack64 ptr v (VSS.stack_from_s s.ms_stack))}
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 88, "end_line": 50, "start_col": 0, "start_line": 49 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') } [@va_qattr] let update_vec (vr:vec) (v:quad32) (s:state) : state = { s with vecs = vecs_make (fun (vr':vec) -> if vr' = vr then v else s.vecs vr') }
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> v: Vale.PPC64LE.Machine_s.nat64 -> s: Vale.PPC64LE.State.state -> Prims.GTot Vale.PPC64LE.State.state
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.PPC64LE.Machine_s.nat64", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Machine_s.Mkstate", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Stack_Sems.stack_to_s", "Vale.PPC64LE.Stack_i.store_stack64", "Vale.PPC64LE.Stack_Sems.stack_from_s", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint" ]
[]
false
false
false
false
false
let update_stack64 (ptr: int) (v: nat64) (s: state) : GTot state =
{ s with ms_stack = VSS.stack_to_s (store_stack64 ptr v (VSS.stack_from_s s.ms_stack)) }
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.state
val state : Type
let state = Vale.PPC64LE.Machine_s.state
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 47, "end_line": 16, "start_col": 7, "start_line": 16 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.state" ]
[]
false
false
false
true
true
let state =
Vale.PPC64LE.Machine_s.state
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.eval_stack128
val eval_stack128 (ptr: int) (s: state) : GTot quad32
val eval_stack128 (ptr: int) (s: state) : GTot quad32
let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack)
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 108, "end_line": 38, "start_col": 7, "start_line": 38 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> s: Vale.PPC64LE.State.state -> Prims.GTot Vale.PPC64LE.Machine_s.quad32
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Stack_i.load_stack128", "Vale.PPC64LE.Stack_Sems.stack_from_s", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.PPC64LE.Machine_s.quad32" ]
[]
false
false
false
false
false
let eval_stack128 (ptr: int) (s: state) : GTot quad32 =
load_stack128 ptr (VSS.stack_from_s s.ms_stack)
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.valid_mem
val valid_mem (m: maddr) (s: state) : prop0
val valid_mem (m: maddr) (s: state) : prop0
let valid_mem (m:maddr) (s:state) : prop0 = valid_maddr_offset64 m.offset /\ valid_maddr m s
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 50, "end_line": 58, "start_col": 0, "start_line": 57 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') } [@va_qattr] let update_vec (vr:vec) (v:quad32) (s:state) : state = { s with vecs = vecs_make (fun (vr':vec) -> if vr' = vr then v else s.vecs vr') } [@va_qattr] let update_stack64 (ptr:int) (v:nat64) (s:state) : GTot state = {s with ms_stack = VSS.stack_to_s (store_stack64 ptr v (VSS.stack_from_s s.ms_stack))} [@va_qattr] let valid_maddr (m:maddr) (s:state) : prop0 = M.valid_mem64 (eval_maddr m s) (M.get_vale_heap (coerce s.ms_heap))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Vale.PPC64LE.Machine_s.maddr -> s: Vale.PPC64LE.State.state -> Vale.Def.Prop_s.prop0
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.maddr", "Vale.PPC64LE.State.state", "Prims.l_and", "Prims.b2t", "Vale.PPC64LE.Machine_s.valid_maddr_offset64", "Vale.PPC64LE.Machine_s.__proj__Mkmaddr__item__offset", "Vale.PPC64LE.State.valid_maddr", "Vale.Def.Prop_s.prop0" ]
[]
false
false
false
true
false
let valid_mem (m: maddr) (s: state) : prop0 =
valid_maddr_offset64 m.offset /\ valid_maddr m s
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.machine_state_equal
val machine_state_equal : s1: Vale.PPC64LE.State.state -> s2: Vale.PPC64LE.State.state -> Prims.logical
let machine_state_equal (s1 s2:state) = s1.ok == s2.ok /\ Regs.equal s1.regs s2.regs /\ Vecs.equal s1.vecs s2.vecs /\ s1.cr0 == s2.cr0 /\ s1.xer == s2.xer /\ s1.ms_heap == s2.ms_heap /\ s1.ms_stack == s2.ms_stack /\ s1.ms_stackTaint == s2.ms_stackTaint /\ True
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 93, "start_col": 0, "start_line": 84 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') } [@va_qattr] let update_vec (vr:vec) (v:quad32) (s:state) : state = { s with vecs = vecs_make (fun (vr':vec) -> if vr' = vr then v else s.vecs vr') } [@va_qattr] let update_stack64 (ptr:int) (v:nat64) (s:state) : GTot state = {s with ms_stack = VSS.stack_to_s (store_stack64 ptr v (VSS.stack_from_s s.ms_stack))} [@va_qattr] let valid_maddr (m:maddr) (s:state) : prop0 = M.valid_mem64 (eval_maddr m s) (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let valid_mem (m:maddr) (s:state) : prop0 = valid_maddr_offset64 m.offset /\ valid_maddr m s [@va_qattr] let valid_mem128 (r:reg) (i:reg) (s:state) : prop0 = M.valid_mem128 (eval_reg r s + eval_reg i s) (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let state_eta (s:state) : state = {s with ms_heap = coerce ({ (coerce s.ms_heap) with vf_heaplets = Map16.eta (coerce s.ms_heap).vf_heaplets }); } [@va_qattr] let state_eq (s0:state) (s1:state) : prop0 = s0.ok == s1.ok /\ Regs.equal s0.regs s1.regs /\ Vecs.equal s0.vecs s1.vecs /\ s0.cr0 == s1.cr0 /\ s0.xer == s1.xer /\ M.vale_full_heap_equal (coerce s0.ms_heap) (coerce s1.ms_heap) /\ s0.ms_stack == s1.ms_stack /\ s0.ms_stackTaint == s1.ms_stackTaint let machine_state_eq (s1 s2:state) = s1 == s2
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: Vale.PPC64LE.State.state -> s2: Vale.PPC64LE.State.state -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.State.state", "Prims.l_and", "Prims.eq2", "Prims.bool", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok", "Vale.PPC64LE.Regs.equal", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs", "Vale.PPC64LE.Vecs.equal", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs", "Vale.PPC64LE.Machine_s.cr0_t", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0", "Vale.PPC64LE.Machine_s.xer_t", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer", "Vale.Arch.Heap.heap_impl", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.machine_stack", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.Arch.HeapTypes_s.memTaint_t", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint", "Prims.l_True", "Prims.logical" ]
[]
false
false
false
true
true
let machine_state_equal (s1 s2: state) =
s1.ok == s2.ok /\ Regs.equal s1.regs s2.regs /\ Vecs.equal s1.vecs s2.vecs /\ s1.cr0 == s2.cr0 /\ s1.xer == s2.xer /\ s1.ms_heap == s2.ms_heap /\ s1.ms_stack == s2.ms_stack /\ s1.ms_stackTaint == s2.ms_stackTaint /\ True
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.machine_state_eq
val machine_state_eq : s1: Vale.PPC64LE.State.state -> s2: Vale.PPC64LE.State.state -> Prims.logical
let machine_state_eq (s1 s2:state) = s1 == s2
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 10, "end_line": 82, "start_col": 0, "start_line": 81 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') } [@va_qattr] let update_vec (vr:vec) (v:quad32) (s:state) : state = { s with vecs = vecs_make (fun (vr':vec) -> if vr' = vr then v else s.vecs vr') } [@va_qattr] let update_stack64 (ptr:int) (v:nat64) (s:state) : GTot state = {s with ms_stack = VSS.stack_to_s (store_stack64 ptr v (VSS.stack_from_s s.ms_stack))} [@va_qattr] let valid_maddr (m:maddr) (s:state) : prop0 = M.valid_mem64 (eval_maddr m s) (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let valid_mem (m:maddr) (s:state) : prop0 = valid_maddr_offset64 m.offset /\ valid_maddr m s [@va_qattr] let valid_mem128 (r:reg) (i:reg) (s:state) : prop0 = M.valid_mem128 (eval_reg r s + eval_reg i s) (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let state_eta (s:state) : state = {s with ms_heap = coerce ({ (coerce s.ms_heap) with vf_heaplets = Map16.eta (coerce s.ms_heap).vf_heaplets }); } [@va_qattr] let state_eq (s0:state) (s1:state) : prop0 = s0.ok == s1.ok /\ Regs.equal s0.regs s1.regs /\ Vecs.equal s0.vecs s1.vecs /\ s0.cr0 == s1.cr0 /\ s0.xer == s1.xer /\ M.vale_full_heap_equal (coerce s0.ms_heap) (coerce s1.ms_heap) /\ s0.ms_stack == s1.ms_stack /\ s0.ms_stackTaint == s1.ms_stackTaint
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: Vale.PPC64LE.State.state -> s2: Vale.PPC64LE.State.state -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.State.state", "Prims.eq2", "Prims.logical" ]
[]
false
false
false
true
true
let machine_state_eq (s1 s2: state) =
s1 == s2
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.ecdh
val ecdh: ecdh_st M64 True
val ecdh: ecdh_st M64 True
let ecdh = generic_ecdh_higher #M64 True scalarmult
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 51, "end_line": 28, "start_col": 0, "start_line": 28 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let point_add_and_double = addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd let point_double = addanddouble_point_double_higher #M64 True C.fmul2 C.fmul1 C.fsqr2 C.fsub C.fadd let montgomery_ladder = generic_montgomery_ladder_higher #M64 True point_double C.cswap2 point_add_and_double let fsquare_times = finv_fsquare_times_higher #M64 True C.fsqr let finv = finv_finv_higher #M64 True C.fmul fsquare_times // Note that here, for implementations of Curve64, we have a generic store_felem // over an *implementation* of add1. (For Curve51, store_felem does not have // that generic aspect.) let store_felem = fields_store_felem_higher #M64 True C.add1 let encode_point = generic_encode_point_higher #M64 True store_felem C.fmul finv let scalarmult = generic_scalarmult_higher #M64 True encode_point montgomery_ladder decode_point
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Curve25519.Generic.ecdh_st Hacl.Impl.Curve25519.Fields.Core.M64 Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.generic_ecdh_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Curve25519_64_Local.scalarmult" ]
[]
false
false
false
true
false
let ecdh =
generic_ecdh_higher #M64 True scalarmult
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.fsquare_times
val fsquare_times : Hacl.Meta.Curve25519.finv_fsquare_times_higher_t Prims.l_True
let fsquare_times = finv_fsquare_times_higher #M64 True C.fsqr
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 62, "end_line": 19, "start_col": 0, "start_line": 19 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let point_add_and_double = addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd let point_double = addanddouble_point_double_higher #M64 True C.fmul2 C.fmul1 C.fsqr2 C.fsub C.fadd let montgomery_ladder =
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Meta.Curve25519.finv_fsquare_times_higher_t Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.finv_fsquare_times_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Impl.Curve25519.Field64.Local.fsqr" ]
[]
false
false
false
true
false
let fsquare_times =
finv_fsquare_times_higher #M64 True C.fsqr
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.finv
val finv : Hacl.Meta.Curve25519.finv_finv_higher_t Prims.l_True
let finv = finv_finv_higher #M64 True C.fmul fsquare_times
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 58, "end_line": 20, "start_col": 0, "start_line": 20 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let point_add_and_double = addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd let point_double = addanddouble_point_double_higher #M64 True C.fmul2 C.fmul1 C.fsqr2 C.fsub C.fadd let montgomery_ladder = generic_montgomery_ladder_higher #M64 True point_double C.cswap2 point_add_and_double
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Meta.Curve25519.finv_finv_higher_t Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.finv_finv_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Impl.Curve25519.Field64.Local.fmul", "Hacl.Curve25519_64_Local.fsquare_times" ]
[]
false
false
false
true
false
let finv =
finv_finv_higher #M64 True C.fmul fsquare_times
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.montgomery_ladder
val montgomery_ladder : Hacl.Meta.Curve25519.generic_montgomery_ladder_higher_t Prims.l_True
let montgomery_ladder = generic_montgomery_ladder_higher #M64 True point_double C.cswap2 point_add_and_double
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 87, "end_line": 18, "start_col": 0, "start_line": 17 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let point_add_and_double = addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd let point_double =
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Meta.Curve25519.generic_montgomery_ladder_higher_t Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.generic_montgomery_ladder_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Curve25519_64_Local.point_double", "Hacl.Impl.Curve25519.Field64.Local.cswap2", "Hacl.Curve25519_64_Local.point_add_and_double" ]
[]
false
false
false
true
false
let montgomery_ladder =
generic_montgomery_ladder_higher #M64 True point_double C.cswap2 point_add_and_double
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.eval_cmp_opr
val eval_cmp_opr (o: cmp_opr) (s: state) : nat64
val eval_cmp_opr (o: cmp_opr) (s: state) : nat64
let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 28, "end_line": 33, "start_col": 0, "start_line": 30 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
o: Vale.PPC64LE.Machine_s.cmp_opr -> s: Vale.PPC64LE.State.state -> Vale.PPC64LE.Machine_s.nat64
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.cmp_opr", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Machine_s.reg", "Vale.PPC64LE.State.eval_reg", "Vale.PPC64LE.Machine_s.imm16", "Vale.PPC64LE.Machine_s.int_to_nat64", "Vale.PPC64LE.Machine_s.nat64" ]
[]
false
false
false
true
false
let eval_cmp_opr (o: cmp_opr) (s: state) : nat64 =
match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.secret_to_public
val secret_to_public: secret_to_public_st M64 True
val secret_to_public: secret_to_public_st M64 True
let secret_to_public = generic_secret_to_public_higher #M64 True scalarmult g25519
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 82, "end_line": 27, "start_col": 0, "start_line": 27 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let point_add_and_double = addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd let point_double = addanddouble_point_double_higher #M64 True C.fmul2 C.fmul1 C.fsqr2 C.fsub C.fadd let montgomery_ladder = generic_montgomery_ladder_higher #M64 True point_double C.cswap2 point_add_and_double let fsquare_times = finv_fsquare_times_higher #M64 True C.fsqr let finv = finv_finv_higher #M64 True C.fmul fsquare_times // Note that here, for implementations of Curve64, we have a generic store_felem // over an *implementation* of add1. (For Curve51, store_felem does not have // that generic aspect.) let store_felem = fields_store_felem_higher #M64 True C.add1 let encode_point = generic_encode_point_higher #M64 True store_felem C.fmul finv
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Curve25519.Generic.secret_to_public_st Hacl.Impl.Curve25519.Fields.Core.M64 Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.generic_secret_to_public_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Curve25519_64_Local.scalarmult", "Hacl.Curve25519_64_Local.g25519" ]
[]
false
false
false
true
false
let secret_to_public =
generic_secret_to_public_higher #M64 True scalarmult g25519
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.eval_mem
val eval_mem (ptr: int) (s: state) : GTot nat64
val eval_mem (ptr: int) (s: state) : GTot nat64
let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap))
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 108, "end_line": 23, "start_col": 7, "start_line": 23 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> s: Vale.PPC64LE.State.state -> Prims.GTot Vale.PPC64LE.Machine_s.nat64
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Memory.load_mem64", "Vale.PPC64LE.Memory.get_vale_heap", "Vale.PPC64LE.State.coerce", "Vale.PPC64LE.Memory.vale_full_heap", "Vale.Arch.Heap.heap_impl", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.nat64" ]
[]
false
false
false
false
false
let eval_mem (ptr: int) (s: state) : GTot nat64 =
M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap))
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.encode_point
val encode_point : Hacl.Meta.Curve25519.generic_encode_point_higher_t Prims.l_True
let encode_point = generic_encode_point_higher #M64 True store_felem C.fmul finv
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 80, "end_line": 25, "start_col": 0, "start_line": 25 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let point_add_and_double = addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd let point_double = addanddouble_point_double_higher #M64 True C.fmul2 C.fmul1 C.fsqr2 C.fsub C.fadd let montgomery_ladder = generic_montgomery_ladder_higher #M64 True point_double C.cswap2 point_add_and_double let fsquare_times = finv_fsquare_times_higher #M64 True C.fsqr let finv = finv_finv_higher #M64 True C.fmul fsquare_times // Note that here, for implementations of Curve64, we have a generic store_felem // over an *implementation* of add1. (For Curve51, store_felem does not have // that generic aspect.)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Meta.Curve25519.generic_encode_point_higher_t Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.generic_encode_point_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Curve25519_64_Local.store_felem", "Hacl.Impl.Curve25519.Field64.Local.fmul", "Hacl.Curve25519_64_Local.finv" ]
[]
false
false
false
true
false
let encode_point =
generic_encode_point_higher #M64 True store_felem C.fmul finv
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.valid_maddr
val valid_maddr (m: maddr) (s: state) : prop0
val valid_maddr (m: maddr) (s: state) : prop0
let valid_maddr (m:maddr) (s:state) : prop0 = M.valid_mem64 (eval_maddr m s) (M.get_vale_heap (coerce s.ms_heap))
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 69, "end_line": 54, "start_col": 0, "start_line": 53 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') } [@va_qattr] let update_vec (vr:vec) (v:quad32) (s:state) : state = { s with vecs = vecs_make (fun (vr':vec) -> if vr' = vr then v else s.vecs vr') } [@va_qattr] let update_stack64 (ptr:int) (v:nat64) (s:state) : GTot state = {s with ms_stack = VSS.stack_to_s (store_stack64 ptr v (VSS.stack_from_s s.ms_stack))}
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Vale.PPC64LE.Machine_s.maddr -> s: Vale.PPC64LE.State.state -> Vale.Def.Prop_s.prop0
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.maddr", "Vale.PPC64LE.State.state", "Prims.b2t", "Vale.PPC64LE.Memory.valid_mem64", "Vale.PPC64LE.State.eval_maddr", "Vale.PPC64LE.Memory.get_vale_heap", "Vale.PPC64LE.State.coerce", "Vale.PPC64LE.Memory.vale_full_heap", "Vale.Arch.Heap.heap_impl", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.Def.Prop_s.prop0" ]
[]
false
false
false
true
false
let valid_maddr (m: maddr) (s: state) : prop0 =
M.valid_mem64 (eval_maddr m s) (M.get_vale_heap (coerce s.ms_heap))
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.update_reg
val update_reg (r: reg) (v: nat64) (s: state) : state
val update_reg (r: reg) (v: nat64) (s: state) : state
let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') }
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 79, "end_line": 42, "start_col": 0, "start_line": 41 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: Vale.PPC64LE.Machine_s.reg -> v: Vale.PPC64LE.Machine_s.nat64 -> s: Vale.PPC64LE.State.state -> Vale.PPC64LE.State.state
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.reg", "Vale.PPC64LE.Machine_s.nat64", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Machine_s.Mkstate", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok", "Vale.PPC64LE.Machine_s.regs_make", "Prims.op_Equality", "Prims.bool", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint" ]
[]
false
false
false
true
false
let update_reg (r: reg) (v: nat64) (s: state) : state =
{ s with regs = regs_make (fun (r': reg) -> if r = r' then v else s.regs r') }
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.update_vec
val update_vec (vr: vec) (v: quad32) (s: state) : state
val update_vec (vr: vec) (v: quad32) (s: state) : state
let update_vec (vr:vec) (v:quad32) (s:state) : state = { s with vecs = vecs_make (fun (vr':vec) -> if vr' = vr then v else s.vecs vr') }
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 83, "end_line": 46, "start_col": 0, "start_line": 45 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') }
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
vr: Vale.PPC64LE.Machine_s.vec -> v: Vale.PPC64LE.Machine_s.quad32 -> s: Vale.PPC64LE.State.state -> Vale.PPC64LE.State.state
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.vec", "Vale.PPC64LE.Machine_s.quad32", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Machine_s.Mkstate", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs", "Vale.PPC64LE.Machine_s.vecs_make", "Prims.op_Equality", "Prims.bool", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint" ]
[]
false
false
false
true
false
let update_vec (vr: vec) (v: quad32) (s: state) : state =
{ s with vecs = vecs_make (fun (vr': vec) -> if vr' = vr then v else s.vecs vr') }
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.store_felem
val store_felem : Hacl.Meta.Curve25519.fields_store_felem_higher_t Prims.l_True
let store_felem = fields_store_felem_higher #M64 True C.add1
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 60, "end_line": 24, "start_col": 0, "start_line": 24 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let point_add_and_double = addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd let point_double = addanddouble_point_double_higher #M64 True C.fmul2 C.fmul1 C.fsqr2 C.fsub C.fadd let montgomery_ladder = generic_montgomery_ladder_higher #M64 True point_double C.cswap2 point_add_and_double let fsquare_times = finv_fsquare_times_higher #M64 True C.fsqr let finv = finv_finv_higher #M64 True C.fmul fsquare_times // Note that here, for implementations of Curve64, we have a generic store_felem // over an *implementation* of add1. (For Curve51, store_felem does not have
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Meta.Curve25519.fields_store_felem_higher_t Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.fields_store_felem_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Impl.Curve25519.Field64.Local.add1" ]
[]
false
false
false
true
false
let store_felem =
fields_store_felem_higher #M64 True C.add1
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.point_double
val point_double : Hacl.Meta.Curve25519.addanddouble_point_double_higher_t Prims.l_True
let point_double = addanddouble_point_double_higher #M64 True C.fmul2 C.fmul1 C.fsqr2 C.fsub C.fadd
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 82, "end_line": 16, "start_col": 0, "start_line": 15 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let point_add_and_double =
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Meta.Curve25519.addanddouble_point_double_higher_t Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.addanddouble_point_double_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Impl.Curve25519.Field64.Local.fmul2", "Hacl.Impl.Curve25519.Field64.Local.fmul1", "Hacl.Impl.Curve25519.Field64.Local.fsqr2", "Hacl.Impl.Curve25519.Field64.Local.fsub", "Hacl.Impl.Curve25519.Field64.Local.fadd" ]
[]
false
false
false
true
false
let point_double =
addanddouble_point_double_higher #M64 True C.fmul2 C.fmul1 C.fsqr2 C.fsub C.fadd
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.point_add_and_double
val point_add_and_double : Hacl.Meta.Curve25519.addanddouble_point_add_and_double_higher_t Prims.l_True
let point_add_and_double = addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 97, "end_line": 14, "start_col": 0, "start_line": 13 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Meta.Curve25519.addanddouble_point_add_and_double_higher_t Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.addanddouble_point_add_and_double_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Impl.Curve25519.Field64.Local.fmul", "Hacl.Impl.Curve25519.Field64.Local.fsqr2", "Hacl.Impl.Curve25519.Field64.Local.fmul1", "Hacl.Impl.Curve25519.Field64.Local.fmul2", "Hacl.Impl.Curve25519.Field64.Local.fsub", "Hacl.Impl.Curve25519.Field64.Local.fadd" ]
[]
false
false
false
true
false
let point_add_and_double =
addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.scalarmult
val scalarmult: scalarmult_st M64 True
val scalarmult: scalarmult_st M64 True
let scalarmult = generic_scalarmult_higher #M64 True encode_point montgomery_ladder decode_point
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 96, "end_line": 26, "start_col": 0, "start_line": 26 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let point_add_and_double = addanddouble_point_add_and_double_higher #M64 True C.fmul C.fsqr2 C.fmul1 C.fmul2 C.fsub C.fadd let point_double = addanddouble_point_double_higher #M64 True C.fmul2 C.fmul1 C.fsqr2 C.fsub C.fadd let montgomery_ladder = generic_montgomery_ladder_higher #M64 True point_double C.cswap2 point_add_and_double let fsquare_times = finv_fsquare_times_higher #M64 True C.fsqr let finv = finv_finv_higher #M64 True C.fmul fsquare_times // Note that here, for implementations of Curve64, we have a generic store_felem // over an *implementation* of add1. (For Curve51, store_felem does not have // that generic aspect.) let store_felem = fields_store_felem_higher #M64 True C.add1
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Curve25519.Generic.scalarmult_st Hacl.Impl.Curve25519.Fields.Core.M64 Prims.l_True
Prims.Tot
[ "total" ]
[]
[ "Hacl.Meta.Curve25519.generic_scalarmult_higher", "Hacl.Impl.Curve25519.Fields.Core.M64", "Prims.l_True", "Hacl.Curve25519_64_Local.encode_point", "Hacl.Curve25519_64_Local.montgomery_ladder", "Hacl.Impl.Curve25519.Generic.decode_point" ]
[]
false
false
false
true
false
let scalarmult =
generic_scalarmult_higher #M64 True encode_point montgomery_ladder decode_point
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.coerce
val coerce (#b #a: Type) (x: a{a == b}) : b
val coerce (#b #a: Type) (x: a{a == b}) : b
let coerce (#b #a:Type) (x:a{a == b}) : b = x
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 52, "end_line": 14, "start_col": 7, "start_line": 14 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: a{a == b} -> b
Prims.Tot
[ "total" ]
[]
[ "Prims.eq2" ]
[]
false
false
false
false
false
let coerce (#b #a: Type) (x: a{a == b}) : b =
x
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.state_eq
val state_eq (s0 s1: state) : prop0
val state_eq (s0 s1: state) : prop0
let state_eq (s0:state) (s1:state) : prop0 = s0.ok == s1.ok /\ Regs.equal s0.regs s1.regs /\ Vecs.equal s0.vecs s1.vecs /\ s0.cr0 == s1.cr0 /\ s0.xer == s1.xer /\ M.vale_full_heap_equal (coerce s0.ms_heap) (coerce s1.ms_heap) /\ s0.ms_stack == s1.ms_stack /\ s0.ms_stackTaint == s1.ms_stackTaint
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 38, "end_line": 79, "start_col": 0, "start_line": 71 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') } [@va_qattr] let update_vec (vr:vec) (v:quad32) (s:state) : state = { s with vecs = vecs_make (fun (vr':vec) -> if vr' = vr then v else s.vecs vr') } [@va_qattr] let update_stack64 (ptr:int) (v:nat64) (s:state) : GTot state = {s with ms_stack = VSS.stack_to_s (store_stack64 ptr v (VSS.stack_from_s s.ms_stack))} [@va_qattr] let valid_maddr (m:maddr) (s:state) : prop0 = M.valid_mem64 (eval_maddr m s) (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let valid_mem (m:maddr) (s:state) : prop0 = valid_maddr_offset64 m.offset /\ valid_maddr m s [@va_qattr] let valid_mem128 (r:reg) (i:reg) (s:state) : prop0 = M.valid_mem128 (eval_reg r s + eval_reg i s) (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let state_eta (s:state) : state = {s with ms_heap = coerce ({ (coerce s.ms_heap) with vf_heaplets = Map16.eta (coerce s.ms_heap).vf_heaplets }); }
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s0: Vale.PPC64LE.State.state -> s1: Vale.PPC64LE.State.state -> Vale.Def.Prop_s.prop0
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.State.state", "Prims.l_and", "Prims.eq2", "Prims.bool", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok", "Vale.PPC64LE.Regs.equal", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs", "Vale.PPC64LE.Vecs.equal", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs", "Vale.PPC64LE.Machine_s.cr0_t", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0", "Vale.PPC64LE.Machine_s.xer_t", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer", "Vale.PPC64LE.Memory.vale_full_heap_equal", "Vale.PPC64LE.State.coerce", "Vale.PPC64LE.Memory.vale_full_heap", "Vale.Arch.Heap.heap_impl", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.machine_stack", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.Arch.HeapTypes_s.memTaint_t", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint", "Vale.Def.Prop_s.prop0" ]
[]
false
false
false
true
false
let state_eq (s0 s1: state) : prop0 =
s0.ok == s1.ok /\ Regs.equal s0.regs s1.regs /\ Vecs.equal s0.vecs s1.vecs /\ s0.cr0 == s1.cr0 /\ s0.xer == s1.xer /\ M.vale_full_heap_equal (coerce s0.ms_heap) (coerce s1.ms_heap) /\ s0.ms_stack == s1.ms_stack /\ s0.ms_stackTaint == s1.ms_stackTaint
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.state_eta
val state_eta (s: state) : state
val state_eta (s: state) : state
let state_eta (s:state) : state = {s with ms_heap = coerce ({ (coerce s.ms_heap) with vf_heaplets = Map16.eta (coerce s.ms_heap).vf_heaplets }); }
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 68, "start_col": 0, "start_line": 65 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') } [@va_qattr] let update_vec (vr:vec) (v:quad32) (s:state) : state = { s with vecs = vecs_make (fun (vr':vec) -> if vr' = vr then v else s.vecs vr') } [@va_qattr] let update_stack64 (ptr:int) (v:nat64) (s:state) : GTot state = {s with ms_stack = VSS.stack_to_s (store_stack64 ptr v (VSS.stack_from_s s.ms_stack))} [@va_qattr] let valid_maddr (m:maddr) (s:state) : prop0 = M.valid_mem64 (eval_maddr m s) (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let valid_mem (m:maddr) (s:state) : prop0 = valid_maddr_offset64 m.offset /\ valid_maddr m s [@va_qattr] let valid_mem128 (r:reg) (i:reg) (s:state) : prop0 = M.valid_mem128 (eval_reg r s + eval_reg i s) (M.get_vale_heap (coerce s.ms_heap))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: Vale.PPC64LE.State.state -> Vale.PPC64LE.State.state
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.State.state", "Vale.PPC64LE.Machine_s.Mkstate", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer", "Vale.PPC64LE.State.coerce", "Vale.Arch.Heap.heap_impl", "Vale.Arch.HeapImpl.vale_full_heap", "Vale.Arch.HeapImpl.Mkvale_full_heap", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heap", "Vale.Lib.Map16.eta", "Vale.Arch.HeapImpl.vale_heap", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint" ]
[]
false
false
false
true
false
let state_eta (s: state) : state =
{ s with ms_heap = coerce ({ (coerce s.ms_heap) with vf_heaplets = Map16.eta (coerce s.ms_heap).vf_heaplets }) }
false
Vale.PPC64LE.State.fsti
Vale.PPC64LE.State.valid_mem128
val valid_mem128 (r i: reg) (s: state) : prop0
val valid_mem128 (r i: reg) (s: state) : prop0
let valid_mem128 (r:reg) (i:reg) (s:state) : prop0 = M.valid_mem128 (eval_reg r s + eval_reg i s) (M.get_vale_heap (coerce s.ms_heap))
{ "file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.State.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 83, "end_line": 62, "start_col": 0, "start_line": 61 }
module Vale.PPC64LE.State // This interface should not refer to Semantics_s open Vale.Def.Prop_s open Vale.PPC64LE.Machine_s module M = Vale.PPC64LE.Memory open Vale.Arch.HeapImpl open Vale.Arch.Heap open Vale.PPC64LE.Stack_i module Map16 = Vale.Lib.Map16 module VSS = Vale.PPC64LE.Stack_Sems val same_heap_types : squash (vale_full_heap == heap_impl) unfold let coerce (#b #a:Type) (x:a{a == b}) : b = x unfold let state = Vale.PPC64LE.Machine_s.state [@va_qattr] unfold let eval_reg (r:reg) (s:state) : nat64 = s.regs r [@va_qattr] unfold let eval_vec (v:vec) (s:state) : quad32 = s.vecs v [@va_qattr] unfold let eval_mem (ptr:int) (s:state) : GTot nat64 = M.load_mem64 ptr (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let eval_maddr (m:maddr) (s:state) : int = eval_reg m.address s + m.offset [@va_qattr] let eval_cmp_opr (o:cmp_opr) (s:state) : nat64 = match o with | CReg r -> eval_reg r s | CImm n -> int_to_nat64 n [@va_qattr] unfold let eval_stack (ptr:int) (s:state) : GTot nat64 = load_stack64 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] unfold let eval_stack128 (ptr:int) (s:state) : GTot quad32 = load_stack128 ptr (VSS.stack_from_s s.ms_stack) [@va_qattr] let update_reg (r:reg) (v:nat64) (s:state) : state = { s with regs = regs_make (fun (r':reg) -> if r = r' then v else s.regs r') } [@va_qattr] let update_vec (vr:vec) (v:quad32) (s:state) : state = { s with vecs = vecs_make (fun (vr':vec) -> if vr' = vr then v else s.vecs vr') } [@va_qattr] let update_stack64 (ptr:int) (v:nat64) (s:state) : GTot state = {s with ms_stack = VSS.stack_to_s (store_stack64 ptr v (VSS.stack_from_s s.ms_stack))} [@va_qattr] let valid_maddr (m:maddr) (s:state) : prop0 = M.valid_mem64 (eval_maddr m s) (M.get_vale_heap (coerce s.ms_heap)) [@va_qattr] let valid_mem (m:maddr) (s:state) : prop0 = valid_maddr_offset64 m.offset /\ valid_maddr m s
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.Vecs.fsti.checked", "Vale.PPC64LE.Stack_Sems.fsti.checked", "Vale.PPC64LE.Stack_i.fsti.checked", "Vale.PPC64LE.Regs.fsti.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.State.fsti" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": "VSS" }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": true, "full_module": "Vale.PPC64LE.Memory", "short_module": "M" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: Vale.PPC64LE.Machine_s.reg -> i: Vale.PPC64LE.Machine_s.reg -> s: Vale.PPC64LE.State.state -> Vale.Def.Prop_s.prop0
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Machine_s.reg", "Vale.PPC64LE.State.state", "Prims.b2t", "Vale.PPC64LE.Memory.valid_mem128", "Prims.op_Addition", "Vale.PPC64LE.State.eval_reg", "Vale.PPC64LE.Memory.get_vale_heap", "Vale.PPC64LE.State.coerce", "Vale.PPC64LE.Memory.vale_full_heap", "Vale.Arch.Heap.heap_impl", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.Def.Prop_s.prop0" ]
[]
false
false
false
true
false
let valid_mem128 (r i: reg) (s: state) : prop0 =
M.valid_mem128 (eval_reg r s + eval_reg i s) (M.get_vale_heap (coerce s.ms_heap))
false
HoareST.fst
HoareST.subcomp
val subcomp (a: Type) (pre_f: pre_t) (post_f: post_t a) (pre_g: pre_t) (post_g: post_t a) (f: repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h: heap). pre_g h ==> pre_f h) /\ (forall (h0: heap) (h1: heap) (x: a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True)
val subcomp (a: Type) (pre_f: pre_t) (post_f: post_t a) (pre_g: pre_t) (post_g: post_t a) (f: repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h: heap). pre_g h ==> pre_f h) /\ (forall (h0: heap) (h1: heap) (x: a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True)
let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 66, "start_col": 0, "start_line": 57 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> pre_f: HoareST.pre_t -> post_f: HoareST.post_t a -> pre_g: HoareST.pre_t -> post_g: HoareST.post_t a -> f: HoareST.repr a pre_f post_f -> Prims.Pure (HoareST.repr a pre_g post_g)
Prims.Pure
[]
[]
[ "HoareST.pre_t", "HoareST.post_t", "HoareST.repr", "Prims.l_and", "Prims.l_Forall", "FStar.Monotonic.Heap.heap", "Prims.l_imp", "Prims.l_True" ]
[]
false
false
false
false
false
let subcomp (a: Type) (pre_f: pre_t) (post_f: post_t a) (pre_g: pre_t) (post_g: post_t a) (f: repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h: heap). pre_g h ==> pre_f h) /\ (forall (h0: heap) (h1: heap) (x: a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) =
f
false
HoareST.fst
HoareST.return
val return (a: Type) (x: a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
val return (a: Type) (x: a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 12, "end_line": 41, "start_col": 0, "start_line": 39 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> x: a -> HoareST.repr a (fun _ -> Prims.l_True) (fun h0 r h1 -> r == x /\ h0 == h1)
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "HoareST.repr", "FStar.Monotonic.Heap.heap", "Prims.l_True", "Prims.l_and", "Prims.eq2" ]
[]
false
false
false
false
false
let return (a: Type) (x: a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) =
fun _ -> x
false
HoareST.fst
HoareST.bind
val bind (a b: Type) (pre_f: pre_t) (post_f: post_t a) (pre_g: (a -> pre_t)) (post_g: (a -> post_t b)) (f: repr a pre_f post_f) (g: (x: a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2)
val bind (a b: Type) (pre_f: pre_t) (post_f: post_t a) (pre_g: (a -> pre_t)) (post_g: (a -> post_t b)) (f: repr a pre_f post_f) (g: (x: a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2)
let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x ()
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 8, "end_line": 53, "start_col": 0, "start_line": 45 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> b: Type -> pre_f: HoareST.pre_t -> post_f: HoareST.post_t a -> pre_g: (_: a -> HoareST.pre_t) -> post_g: (_: a -> HoareST.post_t b) -> f: HoareST.repr a pre_f post_f -> g: (x: a -> HoareST.repr b (pre_g x) (post_g x)) -> HoareST.repr b (fun h0 -> pre_f h0 /\ (forall (x: a) (h1: FStar.Monotonic.Heap.heap). post_f h0 x h1 ==> pre_g x h1) ) (fun h0 y h2 -> exists (x: a) (h1: FStar.Monotonic.Heap.heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2)
Prims.Tot
[ "total" ]
[]
[ "HoareST.pre_t", "HoareST.post_t", "HoareST.repr", "Prims.unit", "FStar.Monotonic.Heap.heap", "Prims.l_and", "Prims.l_Forall", "Prims.l_imp", "Prims.l_Exists" ]
[]
false
false
false
false
false
let bind (a b: Type) (pre_f: pre_t) (post_f: post_t a) (pre_g: (a -> pre_t)) (post_g: (a -> post_t b)) (f: repr a pre_f post_f) (g: (x: a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) =
fun _ -> let x = f () in g x ()
false
HoareST.fst
HoareST.recall
val recall (#a: Type) (#rel: P.preorder a) (r: mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r)
val recall (#a: Type) (#rel: P.preorder a) (r: mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r)
let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r)
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 95, "start_col": 0, "start_line": 89 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: FStar.ST.mref a rel -> HoareST.HoareST Prims.unit
HoareST.HoareST
[]
[]
[ "FStar.Preorder.preorder", "FStar.ST.mref", "Prims.unit", "FStar.ST.recall", "FStar.Monotonic.Heap.heap", "Prims.l_True", "Prims.l_and", "Prims.eq2", "FStar.Monotonic.Heap.contains" ]
[]
false
true
false
false
false
let recall (#a: Type) (#rel: P.preorder a) (r: mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) =
HoareST?.reflect (fun _ -> recall r)
false
HoareST.fst
HoareST.alloc
val alloc (#a: Type) (#rel: P.preorder a) (init: a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init)
val alloc (#a: Type) (#rel: P.preorder a) (init: a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init)
let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init)
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 40, "end_line": 104, "start_col": 0, "start_line": 97 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
init: a -> HoareST.HoareST (FStar.ST.mref a rel)
HoareST.HoareST
[]
[]
[ "FStar.Preorder.preorder", "Prims.unit", "FStar.ST.alloc", "FStar.ST.mref", "FStar.Monotonic.Heap.heap", "Prims.l_True", "Prims.l_and", "FStar.Monotonic.Heap.fresh", "FStar.Monotonic.Heap.modifies", "FStar.Set.empty", "Prims.nat", "Prims.eq2", "FStar.Monotonic.Heap.sel" ]
[]
false
true
false
false
false
let alloc (#a: Type) (#rel: P.preorder a) (init: a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) =
HoareST?.reflect (fun _ -> alloc init)
false
HoareST.fst
HoareST.get
val get: Prims.unit -> HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1)
val get: Prims.unit -> HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1)
let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 22, "end_line": 127, "start_col": 0, "start_line": 123 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> HoareST.HoareST FStar.Monotonic.Heap.heap
HoareST.HoareST
[]
[]
[ "Prims.unit", "FStar.ST.get", "FStar.Monotonic.Heap.heap", "Prims.l_True", "Prims.l_and", "Prims.eq2" ]
[]
false
true
false
false
false
let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) =
HoareST?.reflect get
false
HoareST.fst
HoareST.op_Bang
val ( ! ) (#a: Type) (#rel: P.preorder a) (r: mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r)
val ( ! ) (#a: Type) (#rel: P.preorder a) (r: mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r)
let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r)
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 36, "end_line": 112, "start_col": 0, "start_line": 106 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: FStar.ST.mref a rel -> HoareST.HoareST a
HoareST.HoareST
[]
[]
[ "FStar.Preorder.preorder", "FStar.ST.mref", "Prims.unit", "FStar.ST.read", "FStar.Monotonic.Heap.heap", "Prims.l_True", "Prims.l_and", "Prims.eq2", "FStar.Monotonic.Heap.sel" ]
[]
false
true
false
false
false
let ( ! ) (#a: Type) (#rel: P.preorder a) (r: mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) =
HoareST?.reflect (fun _ -> read r)
false
HoareST.fst
HoareST.op_Colon_Equals
val ( := ) (#a: Type) (#rel: P.preorder a) (r: mref a rel) (x: a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x )
val ( := ) (#a: Type) (#rel: P.preorder a) (r: mref a rel) (x: a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x )
let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x)
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 39, "end_line": 121, "start_col": 0, "start_line": 114 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: FStar.ST.mref a rel -> x: a -> HoareST.HoareST Prims.unit
HoareST.HoareST
[]
[]
[ "FStar.Preorder.preorder", "FStar.ST.mref", "Prims.unit", "FStar.ST.write", "FStar.Monotonic.Heap.heap", "FStar.Monotonic.Heap.sel", "Prims.l_and", "FStar.Monotonic.Heap.modifies", "FStar.Set.singleton", "Prims.nat", "FStar.Monotonic.Heap.addr_of", "FStar.Monotonic.Heap.equal_dom", "Prims.eq2" ]
[]
false
true
false
false
false
let ( := ) (#a: Type) (#rel: P.preorder a) (r: mref a rel) (x: a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x ) =
HoareST?.reflect (fun _ -> write r x)
false
HoareST.fst
HoareST.main
val main : Prims.unit
let main = FStar.IO.print_string "Hello!"
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 41, "end_line": 237, "start_col": 0, "start_line": 237 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x) let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get /// lift from PURE let lift_pure_hoarest (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~ (wp (fun x -> x =!= r \/ h0 =!= h1))) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f () sub_effect PURE ~> HoareST = lift_pure_hoarest /// Implementing the array library using the layered effect module Seq = FStar.Seq type array (a:Type0) = ref (Seq.seq a) let op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) = let s1 = !s1 in let s2 = !s2 in alloc (Seq.append s1 s2) let index (#a:Type0) (x:array a) (i:nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i) = let s = !x in Seq.index s i let upd (#a:Type0) (x:array a) (i:nat) (v:a) : HoareST unit (fun h -> i < Seq.length (sel h x)) (fun h0 _ h1 -> i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) i v) = let s = !x in let s = Seq.upd s i v in x := s let length (#a:Type0) (x:array a) : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1) = let s = !x in Seq.length s let swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j}) : HoareST unit (fun h -> j < Seq.length (sel h x)) (fun h0 _ h1 -> j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.swap (sel h0 x) i j) = let v_i = index x i in let v_j = index x j in upd x j v_i; upd x i v_j let rec copy_aux (#a:Type) (s:array a) (cpy:array a) (ctr:nat) : HoareST unit (fun h -> addr_of s =!= addr_of cpy /\ Seq.length (sel h cpy) == Seq.length (sel h s) /\ ctr <= Seq.length (sel h cpy) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i)) (fun h0 _ h1 -> modifies (only cpy) h0 h1 /\ Seq.equal (sel h1 cpy) (sel h1 s)) = recall s; recall cpy; let len = length cpy in match len - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr + 1) let copy (#a:Type0) (s:array a) : HoareST (array a) (fun h -> Seq.length (sel h s) > 0) (fun h0 r h1 -> modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s) = recall s; let cpy = alloc (Seq.create (length s) (index s 0)) in copy_aux s cpy 0; cpy // // Top-level effect // effect HoareSTT (a:Type) (post:post_t a) = HoareST a (fun _ -> True) post
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.unit
Prims.Tot
[ "total" ]
[]
[ "FStar.IO.print_string", "Prims.unit" ]
[]
false
false
false
true
false
let main =
FStar.IO.print_string "Hello!"
false
HoareST.fst
HoareST.op_At_Bar
val ( @| ) (#a: Type0) (s1 s2: array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1)
val ( @| ) (#a: Type0) (s1 s2: array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1)
let op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) = let s1 = !s1 in let s2 = !s2 in alloc (Seq.append s1 s2)
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 26, "end_line": 157, "start_col": 0, "start_line": 149 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x) let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get /// lift from PURE let lift_pure_hoarest (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~ (wp (fun x -> x =!= r \/ h0 =!= h1))) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f () sub_effect PURE ~> HoareST = lift_pure_hoarest /// Implementing the array library using the layered effect module Seq = FStar.Seq type array (a:Type0) = ref (Seq.seq a)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: HoareST.array a -> s2: HoareST.array a -> HoareST.HoareST (HoareST.array a)
HoareST.HoareST
[]
[]
[ "HoareST.array", "HoareST.alloc", "FStar.Seq.Base.seq", "FStar.Heap.trivial_preorder", "FStar.Seq.Base.append", "FStar.ST.mref", "HoareST.op_Bang", "FStar.Monotonic.Heap.heap", "Prims.l_True", "Prims.l_and", "Prims.eq2", "FStar.Monotonic.Heap.sel", "FStar.Monotonic.Heap.modifies", "FStar.Set.empty", "Prims.nat" ]
[]
false
true
false
false
false
let ( @| ) (#a: Type0) (s1 s2: array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) =
let s1 = !s1 in let s2 = !s2 in alloc (Seq.append s1 s2)
false
HoareST.fst
HoareST.lift_pure_hoarest
val lift_pure_hoarest (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp)) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~(wp (fun x -> x =!= r \/ h0 =!= h1)))
val lift_pure_hoarest (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp)) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~(wp (fun x -> x =!= r \/ h0 =!= h1)))
let lift_pure_hoarest (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~ (wp (fun x -> x =!= r \/ h0 =!= h1))) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f ()
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 15, "end_line": 136, "start_col": 0, "start_line": 131 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x) let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get /// lift from PURE
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> wp: Prims.pure_wp a -> f: (_: Prims.unit -> Prims.PURE a) -> HoareST.repr a (fun _ -> wp (fun _ -> Prims.l_True)) (fun h0 r h1 -> ~(wp (fun x -> ~(x == r) \/ ~(h0 == h1))))
Prims.Tot
[ "total" ]
[]
[ "Prims.pure_wp", "Prims.unit", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "HoareST.repr", "FStar.Monotonic.Heap.heap", "Prims.l_True", "Prims.l_not", "Prims.l_or", "Prims.eq2" ]
[]
false
false
false
false
false
let lift_pure_hoarest (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp)) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~(wp (fun x -> x =!= r \/ h0 =!= h1))) =
FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f ()
false
Steel.MonotonicReference.fst
Steel.MonotonicReference.gather
val gather (#inames:_) (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f g:perm) (v:Ghost.erased a) : SteelGhostT unit inames (pts_to r f v `star` pts_to r g v) (fun _ -> pts_to r (sum_perm f g) v)
val gather (#inames:_) (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f g:perm) (v:Ghost.erased a) : SteelGhostT unit inames (pts_to r f v `star` pts_to r g v) (fun _ -> pts_to r (sum_perm f g) v)
let gather (#inames:_) (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f g:perm) (v:Ghost.erased a) : SteelGhostT unit inames (pts_to r f v `star` pts_to r g v) (fun _ -> pts_to r (sum_perm f g) v) = MHR.gather r f g (hide (U.raise_val (reveal v)))
{ "file_name": "lib/steel/Steel.MonotonicReference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 52, "end_line": 126, "start_col": 0, "start_line": 117 }
(* Copyright 2020 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 Steel.MonotonicReference open FStar.PCM open FStar.Ghost open Steel.FractionalPermission open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Preorder = FStar.Preorder module MHR = Steel.MonotonicHigherReference module U = FStar.Universe let raise_preorder (#a:Type0) (p:Preorder.preorder a) : Preorder.preorder (U.raise_t a) = fun (x0 x1:U.raise_t a) -> p (U.downgrade_val x0) (U.downgrade_val x1) let ref a p = MHR.ref (FStar.Universe.raise_t a) (raise_preorder p) /// The standard points to separation logic predicate let pts_to_sl (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:a) = MHR.pts_to_sl r f (hide (U.raise_val v)) /// Allocates a reference with value [x]. We have full permission on the newly /// allocated reference. let alloc (#a:Type) (p:Preorder.preorder a) (v:a) : SteelT (ref a p) emp (fun r -> pts_to r full_perm v) = let r = MHR.alloc (raise_preorder p) (U.raise_val v) in rewrite_slprop (MHR.pts_to r full_perm (hide (U.raise_val v))) (pts_to r full_perm v) (fun _ -> ()); return r /// Writes value [x] in the reference [r], as long as we have full ownership of [r] let write (#a:Type) (#p:Preorder.preorder a) (#v:erased a) (r:ref a p) (x:a) : Steel unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires fun _ -> p v x /\ True) (ensures fun _ _ _ -> True) = MHR.write r (U.raise_val x); rewrite_slprop (MHR.pts_to _ _ _) (pts_to r full_perm x) (fun _ -> ()) let lift_property (#a:Type u#0) (p:property a) : MHR.property (U.raise_t a) = fun x -> p (U.downgrade_val x) let witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a) = MHR.witnessed r (lift_property fact) /// If [fact] is a stable property for the reference preorder [p], and if /// it holds for the current value [v] of the reference, then we can witness it let witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:erased (ref a p)) (fact:stable_property p) (v:erased a) (_:squash (fact v)) = MHR.witness r (lift_property fact) (hide (U.raise_val (reveal v))) () /// If we previously witnessed the validity of [fact], we can recall its validity let recall (#inames: _) (#a:Type u#0) (#q:perm) (#p:Preorder.preorder a) (fact:property a) (r:erased (ref a p)) (v:erased a) (w:witnessed r fact) = MHR.recall (lift_property fact) r (hide (U.raise_val (reveal v))) w /// Monotonic references are also equipped with the usual fractional permission discipline /// So, you can split a reference into two read-only shares let share (#inames:_) (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:Ghost.erased a) : SteelGhostT unit inames (pts_to r f v) (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v) = MHR.share r f (hide (U.raise_val (reveal v)))
{ "checked_file": "/", "dependencies": [ "Steel.MonotonicHigherReference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.PCM.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Steel.MonotonicReference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.MonotonicHigherReference", "short_module": "MHR" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "FStar.PCM", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: Steel.MonotonicReference.ref a p -> f: Steel.FractionalPermission.perm -> g: Steel.FractionalPermission.perm -> v: FStar.Ghost.erased a -> Steel.Effect.Atomic.SteelGhostT Prims.unit
Steel.Effect.Atomic.SteelGhostT
[]
[]
[ "Steel.Memory.inames", "FStar.Preorder.preorder", "Steel.MonotonicReference.ref", "Steel.FractionalPermission.perm", "FStar.Ghost.erased", "Steel.MonotonicHigherReference.gather", "FStar.Universe.raise_t", "Steel.MonotonicReference.raise_preorder", "FStar.Ghost.hide", "FStar.Universe.raise_val", "FStar.Ghost.reveal", "Prims.unit", "Steel.Effect.Common.star", "Steel.MonotonicReference.pts_to", "Steel.FractionalPermission.sum_perm", "Steel.Effect.Common.vprop" ]
[]
false
true
false
false
false
let gather (#inames: _) (#a: Type) (#p: Preorder.preorder a) (r: ref a p) (f g: perm) (v: Ghost.erased a) : SteelGhostT unit inames ((pts_to r f v) `star` (pts_to r g v)) (fun _ -> pts_to r (sum_perm f g) v) =
MHR.gather r f g (hide (U.raise_val (reveal v)))
false
HoareST.fst
HoareST.length
val length (#a: Type0) (x: array a) : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1)
val length (#a: Type0) (x: array a) : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1)
let length (#a:Type0) (x:array a) : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1) = let s = !x in Seq.length s
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 14, "end_line": 185, "start_col": 0, "start_line": 180 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x) let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get /// lift from PURE let lift_pure_hoarest (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~ (wp (fun x -> x =!= r \/ h0 =!= h1))) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f () sub_effect PURE ~> HoareST = lift_pure_hoarest /// Implementing the array library using the layered effect module Seq = FStar.Seq type array (a:Type0) = ref (Seq.seq a) let op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) = let s1 = !s1 in let s2 = !s2 in alloc (Seq.append s1 s2) let index (#a:Type0) (x:array a) (i:nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i) = let s = !x in Seq.index s i let upd (#a:Type0) (x:array a) (i:nat) (v:a) : HoareST unit (fun h -> i < Seq.length (sel h x)) (fun h0 _ h1 -> i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) i v) = let s = !x in let s = Seq.upd s i v in x := s
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: HoareST.array a -> HoareST.HoareST Prims.nat
HoareST.HoareST
[]
[]
[ "HoareST.array", "FStar.Seq.Base.length", "Prims.nat", "FStar.Seq.Base.seq", "HoareST.op_Bang", "FStar.Heap.trivial_preorder", "FStar.Monotonic.Heap.heap", "Prims.l_True", "Prims.l_and", "Prims.eq2", "FStar.Monotonic.Heap.sel" ]
[]
false
true
false
false
false
let length (#a: Type0) (x: array a) : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1) =
let s = !x in Seq.length s
false
HoareST.fst
HoareST.swap
val swap (#a: Type0) (x: array a) (i: nat) (j: nat{i <= j}) : HoareST unit (fun h -> j < Seq.length (sel h x)) (fun h0 _ h1 -> j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.swap (sel h0 x) i j)
val swap (#a: Type0) (x: array a) (i: nat) (j: nat{i <= j}) : HoareST unit (fun h -> j < Seq.length (sel h x)) (fun h0 _ h1 -> j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.swap (sel h0 x) i j)
let swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j}) : HoareST unit (fun h -> j < Seq.length (sel h x)) (fun h0 _ h1 -> j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.swap (sel h0 x) i j) = let v_i = index x i in let v_j = index x j in upd x j v_i; upd x i v_j
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 13, "end_line": 197, "start_col": 0, "start_line": 187 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x) let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get /// lift from PURE let lift_pure_hoarest (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~ (wp (fun x -> x =!= r \/ h0 =!= h1))) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f () sub_effect PURE ~> HoareST = lift_pure_hoarest /// Implementing the array library using the layered effect module Seq = FStar.Seq type array (a:Type0) = ref (Seq.seq a) let op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) = let s1 = !s1 in let s2 = !s2 in alloc (Seq.append s1 s2) let index (#a:Type0) (x:array a) (i:nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i) = let s = !x in Seq.index s i let upd (#a:Type0) (x:array a) (i:nat) (v:a) : HoareST unit (fun h -> i < Seq.length (sel h x)) (fun h0 _ h1 -> i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) i v) = let s = !x in let s = Seq.upd s i v in x := s let length (#a:Type0) (x:array a) : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1) = let s = !x in Seq.length s
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: HoareST.array a -> i: Prims.nat -> j: Prims.nat{i <= j} -> HoareST.HoareST Prims.unit
HoareST.HoareST
[]
[]
[ "HoareST.array", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "HoareST.upd", "Prims.unit", "HoareST.index", "FStar.Monotonic.Heap.heap", "Prims.op_LessThan", "FStar.Seq.Base.length", "FStar.Monotonic.Heap.sel", "FStar.Seq.Base.seq", "FStar.Heap.trivial_preorder", "Prims.l_and", "FStar.Monotonic.Heap.modifies", "FStar.Set.singleton", "FStar.Monotonic.Heap.addr_of", "Prims.eq2", "FStar.Seq.Properties.swap" ]
[]
false
true
false
false
false
let swap (#a: Type0) (x: array a) (i: nat) (j: nat{i <= j}) : HoareST unit (fun h -> j < Seq.length (sel h x)) (fun h0 _ h1 -> j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.swap (sel h0 x) i j) =
let v_i = index x i in let v_j = index x j in upd x j v_i; upd x i v_j
false
HoareST.fst
HoareST.upd
val upd (#a: Type0) (x: array a) (i: nat) (v: a) : HoareST unit (fun h -> i < Seq.length (sel h x)) (fun h0 _ h1 -> i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) i v)
val upd (#a: Type0) (x: array a) (i: nat) (v: a) : HoareST unit (fun h -> i < Seq.length (sel h x)) (fun h0 _ h1 -> i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) i v)
let upd (#a:Type0) (x:array a) (i:nat) (v:a) : HoareST unit (fun h -> i < Seq.length (sel h x)) (fun h0 _ h1 -> i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) i v) = let s = !x in let s = Seq.upd s i v in x := s
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 8, "end_line": 178, "start_col": 0, "start_line": 169 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x) let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get /// lift from PURE let lift_pure_hoarest (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~ (wp (fun x -> x =!= r \/ h0 =!= h1))) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f () sub_effect PURE ~> HoareST = lift_pure_hoarest /// Implementing the array library using the layered effect module Seq = FStar.Seq type array (a:Type0) = ref (Seq.seq a) let op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) = let s1 = !s1 in let s2 = !s2 in alloc (Seq.append s1 s2) let index (#a:Type0) (x:array a) (i:nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i) = let s = !x in Seq.index s i
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: HoareST.array a -> i: Prims.nat -> v: a -> HoareST.HoareST Prims.unit
HoareST.HoareST
[]
[]
[ "HoareST.array", "Prims.nat", "HoareST.op_Colon_Equals", "FStar.Seq.Base.seq", "FStar.Heap.trivial_preorder", "Prims.unit", "FStar.Seq.Base.upd", "HoareST.op_Bang", "FStar.Monotonic.Heap.heap", "Prims.b2t", "Prims.op_LessThan", "FStar.Seq.Base.length", "FStar.Monotonic.Heap.sel", "Prims.l_and", "FStar.Monotonic.Heap.modifies", "FStar.Set.singleton", "FStar.Monotonic.Heap.addr_of", "Prims.eq2" ]
[]
false
true
false
false
false
let upd (#a: Type0) (x: array a) (i: nat) (v: a) : HoareST unit (fun h -> i < Seq.length (sel h x)) (fun h0 _ h1 -> i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) i v) =
let s = !x in let s = Seq.upd s i v in x := s
false
HoareST.fst
HoareST.index
val index (#a: Type0) (x: array a) (i: nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i)
val index (#a: Type0) (x: array a) (i: nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i)
let index (#a:Type0) (x:array a) (i:nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i) = let s = !x in Seq.index s i
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 15, "end_line": 167, "start_col": 0, "start_line": 159 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x) let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get /// lift from PURE let lift_pure_hoarest (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~ (wp (fun x -> x =!= r \/ h0 =!= h1))) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f () sub_effect PURE ~> HoareST = lift_pure_hoarest /// Implementing the array library using the layered effect module Seq = FStar.Seq type array (a:Type0) = ref (Seq.seq a) let op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) = let s1 = !s1 in let s2 = !s2 in alloc (Seq.append s1 s2)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: HoareST.array a -> i: Prims.nat -> HoareST.HoareST a
HoareST.HoareST
[]
[]
[ "HoareST.array", "Prims.nat", "FStar.Seq.Base.index", "FStar.Seq.Base.seq", "HoareST.op_Bang", "FStar.Heap.trivial_preorder", "FStar.Monotonic.Heap.heap", "Prims.b2t", "Prims.op_LessThan", "FStar.Seq.Base.length", "FStar.Monotonic.Heap.sel", "Prims.l_and", "Prims.eq2" ]
[]
false
true
false
false
false
let index (#a: Type0) (x: array a) (i: nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i) =
let s = !x in Seq.index s i
false
HoareST.fst
HoareST.copy
val copy (#a: Type0) (s: array a) : HoareST (array a) (fun h -> Seq.length (sel h s) > 0) (fun h0 r h1 -> modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s)
val copy (#a: Type0) (s: array a) : HoareST (array a) (fun h -> Seq.length (sel h s) > 0) (fun h0 r h1 -> modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s)
let copy (#a:Type0) (s:array a) : HoareST (array a) (fun h -> Seq.length (sel h s) > 0) (fun h0 r h1 -> modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s) = recall s; let cpy = alloc (Seq.create (length s) (index s 0)) in copy_aux s cpy 0; cpy
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 5, "end_line": 229, "start_col": 0, "start_line": 218 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x) let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get /// lift from PURE let lift_pure_hoarest (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~ (wp (fun x -> x =!= r \/ h0 =!= h1))) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f () sub_effect PURE ~> HoareST = lift_pure_hoarest /// Implementing the array library using the layered effect module Seq = FStar.Seq type array (a:Type0) = ref (Seq.seq a) let op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) = let s1 = !s1 in let s2 = !s2 in alloc (Seq.append s1 s2) let index (#a:Type0) (x:array a) (i:nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i) = let s = !x in Seq.index s i let upd (#a:Type0) (x:array a) (i:nat) (v:a) : HoareST unit (fun h -> i < Seq.length (sel h x)) (fun h0 _ h1 -> i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) i v) = let s = !x in let s = Seq.upd s i v in x := s let length (#a:Type0) (x:array a) : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1) = let s = !x in Seq.length s let swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j}) : HoareST unit (fun h -> j < Seq.length (sel h x)) (fun h0 _ h1 -> j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.swap (sel h0 x) i j) = let v_i = index x i in let v_j = index x j in upd x j v_i; upd x i v_j let rec copy_aux (#a:Type) (s:array a) (cpy:array a) (ctr:nat) : HoareST unit (fun h -> addr_of s =!= addr_of cpy /\ Seq.length (sel h cpy) == Seq.length (sel h s) /\ ctr <= Seq.length (sel h cpy) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i)) (fun h0 _ h1 -> modifies (only cpy) h0 h1 /\ Seq.equal (sel h1 cpy) (sel h1 s)) = recall s; recall cpy; let len = length cpy in match len - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr + 1)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: HoareST.array a -> HoareST.HoareST (HoareST.array a)
HoareST.HoareST
[]
[]
[ "HoareST.array", "Prims.unit", "HoareST.copy_aux", "FStar.ST.mref", "FStar.Seq.Base.seq", "FStar.Heap.trivial_preorder", "HoareST.alloc", "FStar.Seq.Base.create", "HoareST.index", "Prims.nat", "HoareST.length", "HoareST.recall", "FStar.Monotonic.Heap.heap", "Prims.b2t", "Prims.op_GreaterThan", "FStar.Seq.Base.length", "FStar.Monotonic.Heap.sel", "Prims.l_and", "FStar.Monotonic.Heap.modifies", "FStar.Set.empty", "FStar.Monotonic.Heap.unused_in", "FStar.Monotonic.Heap.contains", "Prims.eq2" ]
[]
false
true
false
false
false
let copy (#a: Type0) (s: array a) : HoareST (array a) (fun h -> Seq.length (sel h s) > 0) (fun h0 r h1 -> modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s) =
recall s; let cpy = alloc (Seq.create (length s) (index s 0)) in copy_aux s cpy 0; cpy
false
Steel.MonotonicReference.fst
Steel.MonotonicReference.share
val share (#inames:_) (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:Ghost.erased a) : SteelGhostT unit inames (pts_to r f v) (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)
val share (#inames:_) (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:Ghost.erased a) : SteelGhostT unit inames (pts_to r f v) (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)
let share (#inames:_) (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:Ghost.erased a) : SteelGhostT unit inames (pts_to r f v) (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v) = MHR.share r f (hide (U.raise_val (reveal v)))
{ "file_name": "lib/steel/Steel.MonotonicReference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 49, "end_line": 114, "start_col": 0, "start_line": 105 }
(* Copyright 2020 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 Steel.MonotonicReference open FStar.PCM open FStar.Ghost open Steel.FractionalPermission open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Preorder = FStar.Preorder module MHR = Steel.MonotonicHigherReference module U = FStar.Universe let raise_preorder (#a:Type0) (p:Preorder.preorder a) : Preorder.preorder (U.raise_t a) = fun (x0 x1:U.raise_t a) -> p (U.downgrade_val x0) (U.downgrade_val x1) let ref a p = MHR.ref (FStar.Universe.raise_t a) (raise_preorder p) /// The standard points to separation logic predicate let pts_to_sl (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:a) = MHR.pts_to_sl r f (hide (U.raise_val v)) /// Allocates a reference with value [x]. We have full permission on the newly /// allocated reference. let alloc (#a:Type) (p:Preorder.preorder a) (v:a) : SteelT (ref a p) emp (fun r -> pts_to r full_perm v) = let r = MHR.alloc (raise_preorder p) (U.raise_val v) in rewrite_slprop (MHR.pts_to r full_perm (hide (U.raise_val v))) (pts_to r full_perm v) (fun _ -> ()); return r /// Writes value [x] in the reference [r], as long as we have full ownership of [r] let write (#a:Type) (#p:Preorder.preorder a) (#v:erased a) (r:ref a p) (x:a) : Steel unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires fun _ -> p v x /\ True) (ensures fun _ _ _ -> True) = MHR.write r (U.raise_val x); rewrite_slprop (MHR.pts_to _ _ _) (pts_to r full_perm x) (fun _ -> ()) let lift_property (#a:Type u#0) (p:property a) : MHR.property (U.raise_t a) = fun x -> p (U.downgrade_val x) let witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a) = MHR.witnessed r (lift_property fact) /// If [fact] is a stable property for the reference preorder [p], and if /// it holds for the current value [v] of the reference, then we can witness it let witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:erased (ref a p)) (fact:stable_property p) (v:erased a) (_:squash (fact v)) = MHR.witness r (lift_property fact) (hide (U.raise_val (reveal v))) () /// If we previously witnessed the validity of [fact], we can recall its validity let recall (#inames: _) (#a:Type u#0) (#q:perm) (#p:Preorder.preorder a) (fact:property a) (r:erased (ref a p)) (v:erased a) (w:witnessed r fact) = MHR.recall (lift_property fact) r (hide (U.raise_val (reveal v))) w /// Monotonic references are also equipped with the usual fractional permission discipline
{ "checked_file": "/", "dependencies": [ "Steel.MonotonicHigherReference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.PCM.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Steel.MonotonicReference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.MonotonicHigherReference", "short_module": "MHR" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "FStar.PCM", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: Steel.MonotonicReference.ref a p -> f: Steel.FractionalPermission.perm -> v: FStar.Ghost.erased a -> Steel.Effect.Atomic.SteelGhostT Prims.unit
Steel.Effect.Atomic.SteelGhostT
[]
[]
[ "Steel.Memory.inames", "FStar.Preorder.preorder", "Steel.MonotonicReference.ref", "Steel.FractionalPermission.perm", "FStar.Ghost.erased", "Steel.MonotonicHigherReference.share", "FStar.Universe.raise_t", "Steel.MonotonicReference.raise_preorder", "FStar.Ghost.hide", "FStar.Universe.raise_val", "FStar.Ghost.reveal", "Prims.unit", "Steel.MonotonicReference.pts_to", "Steel.Effect.Common.star", "Steel.FractionalPermission.half_perm", "Steel.Effect.Common.vprop" ]
[]
false
true
false
false
false
let share (#inames: _) (#a: Type) (#p: Preorder.preorder a) (r: ref a p) (f: perm) (v: Ghost.erased a) : SteelGhostT unit inames (pts_to r f v) (fun _ -> (pts_to r (half_perm f) v) `star` (pts_to r (half_perm f) v)) =
MHR.share r f (hide (U.raise_val (reveal v)))
false
HoareST.fst
HoareST.copy_aux
val copy_aux (#a: Type) (s cpy: array a) (ctr: nat) : HoareST unit (fun h -> addr_of s =!= addr_of cpy /\ Seq.length (sel h cpy) == Seq.length (sel h s) /\ ctr <= Seq.length (sel h cpy) /\ (forall (i: nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i)) (fun h0 _ h1 -> modifies (only cpy) h0 h1 /\ Seq.equal (sel h1 cpy) (sel h1 s))
val copy_aux (#a: Type) (s cpy: array a) (ctr: nat) : HoareST unit (fun h -> addr_of s =!= addr_of cpy /\ Seq.length (sel h cpy) == Seq.length (sel h s) /\ ctr <= Seq.length (sel h cpy) /\ (forall (i: nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i)) (fun h0 _ h1 -> modifies (only cpy) h0 h1 /\ Seq.equal (sel h1 cpy) (sel h1 s))
let rec copy_aux (#a:Type) (s:array a) (cpy:array a) (ctr:nat) : HoareST unit (fun h -> addr_of s =!= addr_of cpy /\ Seq.length (sel h cpy) == Seq.length (sel h s) /\ ctr <= Seq.length (sel h cpy) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i)) (fun h0 _ h1 -> modifies (only cpy) h0 h1 /\ Seq.equal (sel h1 cpy) (sel h1 s)) = recall s; recall cpy; let len = length cpy in match len - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr + 1)
{ "file_name": "examples/layeredeffects/HoareST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 216, "start_col": 0, "start_line": 199 }
(* 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 HoareST open FStar.Heap open FStar.ST module P = FStar.Preorder module ST = FStar.ST /// ST effect implemented as a layered effect over STATE #set-options "--max_fuel 0 --max_ifuel 0" type pre_t = heap -> Type0 type post_t (a:Type) = heap -> a -> heap -> Type0 /// It has two indices: one for the precondition and one for the postcondition /// /// Its encoding in STATE is as expected type repr (a:Type) (pre:pre_t) (post:post_t a) : Type = unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1)) let return (a:Type) (x:a) : repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1) = fun _ -> x /// bind bakes in the weakening of f's post to compose it with g's pre let bind (a:Type) (b:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b) (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x))) : repr b (fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1)) (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2) = fun _ -> let x = f () in g x () /// sub comp rule let subcomp (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) : Pure (repr a pre_g post_g) (requires (forall (h:heap). pre_g h ==> pre_f h) /\ (forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (pre_f:pre_t) (post_f:post_t a) (pre_g:pre_t) (post_g:post_t a) (f:repr a pre_f post_f) (g:repr a pre_g post_g) (p:bool) : Type = repr a (fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h)) (fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1)) [@@ top_level_effect "HoareST.HoareSTT"; primitive_extraction] reflectable effect { HoareST (a:Type) (pre:pre_t) (post:post_t a) with {repr; return; bind; subcomp; if_then_else} } /// Effect actions from FStar.ST let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\ h1 `Heap.contains` r) = HoareST?.reflect (fun _ -> recall r) let alloc (#a:Type) (#rel:P.preorder a) (init:a) : HoareST (mref a rel) (fun _ -> True) (fun h0 r h1 -> fresh r h0 h1 /\ modifies Set.empty h0 h1 /\ sel h1 r == init) = HoareST?.reflect (fun _ -> alloc init) let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel) : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\ x == sel h1 r) = HoareST?.reflect (fun _ -> read r) let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a) : HoareST unit (fun h -> rel (sel h r) x) (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\ equal_dom h0 h1 /\ sel h1 r == x) = HoareST?.reflect (fun _ -> write r x) let get () : HoareST heap (fun _ -> True) (fun h0 h h1 -> h0 == h1 /\ h == h1) = HoareST?.reflect get /// lift from PURE let lift_pure_hoarest (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (fun _ -> wp (fun _ -> True)) (fun h0 r h1 -> ~ (wp (fun x -> x =!= r \/ h0 =!= h1))) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> f () sub_effect PURE ~> HoareST = lift_pure_hoarest /// Implementing the array library using the layered effect module Seq = FStar.Seq type array (a:Type0) = ref (Seq.seq a) let op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : HoareST (array a) (fun _ -> True) (fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) = let s1 = !s1 in let s2 = !s2 in alloc (Seq.append s1 s2) let index (#a:Type0) (x:array a) (i:nat) : HoareST a (fun h -> i < Seq.length (sel h x)) (fun h0 v h1 -> i < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) i) = let s = !x in Seq.index s i let upd (#a:Type0) (x:array a) (i:nat) (v:a) : HoareST unit (fun h -> i < Seq.length (sel h x)) (fun h0 _ h1 -> i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) i v) = let s = !x in let s = Seq.upd s i v in x := s let length (#a:Type0) (x:array a) : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1) = let s = !x in Seq.length s let swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j}) : HoareST unit (fun h -> j < Seq.length (sel h x)) (fun h0 _ h1 -> j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.swap (sel h0 x) i j) = let v_i = index x i in let v_j = index x j in upd x j v_i; upd x i v_j
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Set.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.IO.fst.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "HoareST.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: HoareST.array a -> cpy: HoareST.array a -> ctr: Prims.nat -> HoareST.HoareST Prims.unit
HoareST.HoareST
[]
[]
[ "HoareST.array", "Prims.nat", "Prims.op_Subtraction", "Prims.unit", "Prims.int", "HoareST.copy_aux", "Prims.op_Addition", "HoareST.upd", "HoareST.index", "HoareST.length", "HoareST.recall", "FStar.Seq.Base.seq", "FStar.Heap.trivial_preorder", "FStar.Monotonic.Heap.heap", "Prims.l_and", "Prims.l_not", "Prims.eq2", "Prims.pos", "FStar.Monotonic.Heap.addr_of", "FStar.Seq.Base.length", "FStar.Monotonic.Heap.sel", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.l_Forall", "Prims.l_imp", "Prims.op_LessThan", "FStar.Seq.Base.index", "FStar.Monotonic.Heap.modifies", "FStar.Monotonic.Heap.only", "FStar.Seq.Base.equal" ]
[ "recursion" ]
false
true
false
false
false
let rec copy_aux (#a: Type) (s cpy: array a) (ctr: nat) : HoareST unit (fun h -> addr_of s =!= addr_of cpy /\ Seq.length (sel h cpy) == Seq.length (sel h s) /\ ctr <= Seq.length (sel h cpy) /\ (forall (i: nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i)) (fun h0 _ h1 -> modifies (only cpy) h0 h1 /\ Seq.equal (sel h1 cpy) (sel h1 s)) =
recall s; recall cpy; let len = length cpy in match len - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr + 1)
false
Hacl.Curve25519_64_Local.fst
Hacl.Curve25519_64_Local.g25519
val g25519:g25519_t
val g25519:g25519_t
let g25519: g25519_t = Lib.Buffer.createL_global Spec.Curve25519.basepoint_list
{ "file_name": "code/curve25519/Hacl.Curve25519_64_Local.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 58, "end_line": 10, "start_col": 0, "start_line": 9 }
module Hacl.Curve25519_64_Local friend Hacl.Meta.Curve25519 open Hacl.Meta.Curve25519 // The assumed core. module C = Hacl.Impl.Curve25519.Field64.Local
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Buffer.fsti.checked", "Hacl.Meta.Curve25519.fst.checked", "Hacl.Impl.Curve25519.Field64.Local.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Curve25519_64_Local.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64.Local", "short_module": "C" }, { "abbrev": false, "full_module": "Hacl.Meta.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Generic", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Curve25519.Generic.g25519_t
Prims.Tot
[ "total" ]
[]
[ "Lib.Buffer.createL_global", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.PUB", "Spec.Curve25519.basepoint_list", "Lib.Buffer.glbuffer", "Lib.IntTypes.size", "FStar.Pervasives.normalize_term", "Lib.IntTypes.size_nat", "FStar.List.Tot.Base.length" ]
[]
false
false
false
true
false
let g25519:g25519_t =
Lib.Buffer.createL_global Spec.Curve25519.basepoint_list
false
Pulse.Checker.If.fst
Pulse.Checker.If.check
val check (g:env) (pre:term) (pre_typing: tot_typing g pre tm_vprop) (post_hint:post_hint_for_env g) (res_ppname:ppname) (b:term) (e1 e2:st_term) (check:check_t) : T.Tac (checker_result_t g pre (Some post_hint))
val check (g:env) (pre:term) (pre_typing: tot_typing g pre tm_vprop) (post_hint:post_hint_for_env g) (res_ppname:ppname) (b:term) (e1 e2:st_term) (check:check_t) : T.Tac (checker_result_t g pre (Some post_hint))
let check (g:env) (pre:term) (pre_typing: tot_typing g pre tm_vprop) (post_hint:post_hint_for_env g) (res_ppname:ppname) (b:term) (e1 e2:st_term) (check:check_t) : T.Tac (checker_result_t g pre (Some post_hint)) = let g = Pulse.Typing.Env.push_context g "check_if" e1.range in let (| b, b_typing |) = check_tot_term g b tm_bool in let post = post_hint.post in let hyp = fresh g in let g_with_eq (eq_v:term) = push_binding g hyp (mk_ppname_no_range "_if_hyp") (mk_eq2 u0 tm_bool b eq_v) in let check_branch (eq_v:term) (br:st_term) (is_then:bool) : T.Tac (br:st_term { ~(hyp `Set.mem` freevars_st br) } & c:comp_st { comp_pre c == pre /\ comp_post_matches_hint c (Some post_hint)} & st_typing (g_with_eq eq_v) br c) = let g_with_eq = g_with_eq eq_v in let pre_typing = Metatheory.tot_typing_weakening_single pre_typing hyp (mk_eq2 u0 tm_bool b eq_v) in let (| br, c, d |) = let ppname = mk_ppname_no_range "_if_br" in let r = check g_with_eq pre pre_typing (Some post_hint) ppname br in apply_checker_result_k r ppname in let br_name = if is_then then "then" else "else" in if hyp `Set.mem` freevars_st br then fail g (Some br.range) (Printf.sprintf "check_if: branch hypothesis is in freevars of checked %s branch" br_name) else (| br, c, d |) in let (| e1, c1, e1_typing |) = check_branch tm_true e1 true in let (| e2, c2, e2_typing |) = check_branch tm_false e2 false in let (| c, e1_typing, e2_typing |) = J.join_comps _ _ _ e1_typing _ _ _ e2_typing post_hint in let c_typing = comp_typing_from_post_hint c pre_typing post_hint in let d : st_typing_in_ctxt g pre (Some post_hint) = (| _, c, T_If g b e1 e2 c hyp b_typing e1_typing e2_typing (E c_typing) |) in checker_result_for_st_typing d res_ppname
{ "file_name": "lib/steel/pulse/Pulse.Checker.If.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 43, "end_line": 92, "start_col": 0, "start_line": 34 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Pulse.Checker.If open Pulse.Syntax open Pulse.Typing open Pulse.Typing.Combinators open Pulse.Checker.Pure open Pulse.Checker.Base open Pulse.Checker.Prover module T = FStar.Tactics.V2 module P = Pulse.Syntax.Printer module Metatheory = Pulse.Typing.Metatheory module RU = Pulse.RuntimeUtils module J = Pulse.JoinComp #set-options "--z3rlimit 40"
{ "checked_file": "/", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.Env.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Typing.fst.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.Syntax.fst.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.JoinComp.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "Pulse.Checker.Prover.fsti.checked", "Pulse.Checker.Base.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.If.fst" }
[ { "abbrev": true, "full_module": "Pulse.JoinComp", "short_module": "J" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": false, "full_module": "Pulse.Checker.Prover", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker.Base", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker.Pure", "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": "Pulse.Checker.Base", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "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 } ]
{ "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": 40, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
g: Pulse.Typing.Env.env -> pre: Pulse.Syntax.Base.term -> pre_typing: Pulse.Typing.tot_typing g pre Pulse.Syntax.Base.tm_vprop -> post_hint: Pulse.Typing.post_hint_for_env g -> res_ppname: Pulse.Syntax.Base.ppname -> b: Pulse.Syntax.Base.term -> e1: Pulse.Syntax.Base.st_term -> e2: Pulse.Syntax.Base.st_term -> check: Pulse.Checker.Base.check_t -> FStar.Tactics.Effect.Tac (Pulse.Checker.Base.checker_result_t g pre (FStar.Pervasives.Native.Some post_hint))
FStar.Tactics.Effect.Tac
[]
[]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.term", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.tm_vprop", "Pulse.Typing.post_hint_for_env", "Pulse.Syntax.Base.ppname", "Pulse.Syntax.Base.st_term", "Pulse.Checker.Base.check_t", "Pulse.Typing.tm_bool", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "Pulse.Syntax.Base.var", "Pulse.Syntax.Naming.freevars_st", "Pulse.Syntax.Base.comp_st", "Prims.l_and", "Prims.eq2", "Pulse.Syntax.Base.comp_pre", "Pulse.Typing.comp_post_matches_hint", "FStar.Pervasives.Native.Some", "Pulse.Typing.post_hint_t", "Pulse.Typing.st_typing", "Pulse.Typing.tm_true", "Pulse.Typing.tm_false", "Pulse.Checker.Base.checker_result_for_st_typing", "Pulse.Checker.Base.checker_result_t", "Pulse.Typing.Combinators.st_typing_in_ctxt", "FStar.Pervasives.Mkdtuple3", "Pulse.Syntax.Base.vprop", "Pulse.Typing.wr", "Pulse.Syntax.Base.Tm_If", "Pulse.Syntax.Base.Mkst_term'__Tm_If__payload", "FStar.Pervasives.Native.None", "Pulse.Typing.T_If", "Pulse.Typing.E", "Pulse.Typing.comp_typing_u", "Pulse.Checker.Base.comp_typing_from_post_hint", "FStar.Pervasives.dtuple3", "Pulse.JoinComp.join_comps", "Prims.bool", "Pulse.Typing.Env.fail", "Pulse.Syntax.Base.range", "Pulse.Syntax.Base.__proj__Mkst_term__item__range", "FStar.Printf.sprintf", "Prims.string", "Pulse.Checker.Base.apply_checker_result_k", "Pulse.Syntax.Base.mk_ppname_no_range", "Pulse.Typing.Env.push_binding", "Pulse.Syntax.Base.ppname_default", "Pulse.Typing.mk_eq2", "Pulse.Syntax.Pure.u0", "Pulse.Typing.Metatheory.tot_typing_weakening_single", "FStar.Reflection.Typing.fstar_top_env", "Pulse.Typing.Env.fstar_env", "Pulse.Typing.Env.dom", "Pulse.Typing.Env.fresh", "Pulse.Typing.__proj__Mkpost_hint_t__item__post", "Prims.dtuple2", "Pulse.Checker.Pure.check_tot_term", "Pulse.Typing.Env.push_context" ]
[]
false
true
false
false
false
let check (g: env) (pre: term) (pre_typing: tot_typing g pre tm_vprop) (post_hint: post_hint_for_env g) (res_ppname: ppname) (b: term) (e1 e2: st_term) (check: check_t) : T.Tac (checker_result_t g pre (Some post_hint)) =
let g = Pulse.Typing.Env.push_context g "check_if" e1.range in let (| b , b_typing |) = check_tot_term g b tm_bool in let post = post_hint.post in let hyp = fresh g in let g_with_eq (eq_v: term) = push_binding g hyp (mk_ppname_no_range "_if_hyp") (mk_eq2 u0 tm_bool b eq_v) in let check_branch (eq_v: term) (br: st_term) (is_then: bool) : T.Tac (br: st_term{~(hyp `Set.mem` (freevars_st br))} & c: comp_st{comp_pre c == pre /\ comp_post_matches_hint c (Some post_hint)} & st_typing (g_with_eq eq_v) br c) = let g_with_eq = g_with_eq eq_v in let pre_typing = Metatheory.tot_typing_weakening_single pre_typing hyp (mk_eq2 u0 tm_bool b eq_v) in let (| br , c , d |) = let ppname = mk_ppname_no_range "_if_br" in let r = check g_with_eq pre pre_typing (Some post_hint) ppname br in apply_checker_result_k r ppname in let br_name = if is_then then "then" else "else" in if hyp `Set.mem` (freevars_st br) then fail g (Some br.range) (Printf.sprintf "check_if: branch hypothesis is in freevars of checked %s branch" br_name) else (| br, c, d |) in let (| e1 , c1 , e1_typing |) = check_branch tm_true e1 true in let (| e2 , c2 , e2_typing |) = check_branch tm_false e2 false in let (| c , e1_typing , e2_typing |) = J.join_comps _ _ _ e1_typing _ _ _ e2_typing post_hint in let c_typing = comp_typing_from_post_hint c pre_typing post_hint in let d:st_typing_in_ctxt g pre (Some post_hint) = (| _, c, T_If g b e1 e2 c hyp b_typing e1_typing e2_typing (E c_typing) |) in checker_result_for_st_typing d res_ppname
false
Steel.MonotonicReference.fst
Steel.MonotonicReference.write
val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a) (r:ref a p) (x:a) : Steel unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires fun _ -> p v x /\ True) (ensures fun _ _ _ -> True)
val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a) (r:ref a p) (x:a) : Steel unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires fun _ -> p v x /\ True) (ensures fun _ _ _ -> True)
let write (#a:Type) (#p:Preorder.preorder a) (#v:erased a) (r:ref a p) (x:a) : Steel unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires fun _ -> p v x /\ True) (ensures fun _ _ _ -> True) = MHR.write r (U.raise_val x); rewrite_slprop (MHR.pts_to _ _ _) (pts_to r full_perm x) (fun _ -> ())
{ "file_name": "lib/steel/Steel.MonotonicReference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 19, "end_line": 68, "start_col": 0, "start_line": 58 }
(* Copyright 2020 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 Steel.MonotonicReference open FStar.PCM open FStar.Ghost open Steel.FractionalPermission open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Preorder = FStar.Preorder module MHR = Steel.MonotonicHigherReference module U = FStar.Universe let raise_preorder (#a:Type0) (p:Preorder.preorder a) : Preorder.preorder (U.raise_t a) = fun (x0 x1:U.raise_t a) -> p (U.downgrade_val x0) (U.downgrade_val x1) let ref a p = MHR.ref (FStar.Universe.raise_t a) (raise_preorder p) /// The standard points to separation logic predicate let pts_to_sl (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:a) = MHR.pts_to_sl r f (hide (U.raise_val v)) /// Allocates a reference with value [x]. We have full permission on the newly /// allocated reference. let alloc (#a:Type) (p:Preorder.preorder a) (v:a) : SteelT (ref a p) emp (fun r -> pts_to r full_perm v) = let r = MHR.alloc (raise_preorder p) (U.raise_val v) in rewrite_slprop (MHR.pts_to r full_perm (hide (U.raise_val v))) (pts_to r full_perm v) (fun _ -> ()); return r
{ "checked_file": "/", "dependencies": [ "Steel.MonotonicHigherReference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.PCM.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Steel.MonotonicReference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.MonotonicHigherReference", "short_module": "MHR" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "FStar.PCM", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: Steel.MonotonicReference.ref a p -> x: a -> Steel.Effect.Steel Prims.unit
Steel.Effect.Steel
[]
[]
[ "FStar.Preorder.preorder", "FStar.Ghost.erased", "Steel.MonotonicReference.ref", "Steel.Effect.Atomic.rewrite_slprop", "FStar.Ghost.hide", "FStar.Set.set", "Steel.Memory.iname", "FStar.Set.empty", "Steel.MonotonicHigherReference.pts_to", "FStar.Universe.raise_t", "Steel.MonotonicReference.raise_preorder", "Steel.FractionalPermission.full_perm", "FStar.Universe.raise_val", "Steel.MonotonicReference.pts_to", "Steel.Memory.mem", "Prims.unit", "Steel.MonotonicHigherReference.write", "FStar.Ghost.reveal", "Steel.Effect.Common.vprop", "Steel.Effect.Common.rmem", "Prims.l_and", "Prims.l_True" ]
[]
false
true
false
false
false
let write (#a: Type) (#p: Preorder.preorder a) (#v: erased a) (r: ref a p) (x: a) : Steel unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires fun _ -> p v x /\ True) (ensures fun _ _ _ -> True) =
MHR.write r (U.raise_val x); rewrite_slprop (MHR.pts_to _ _ _) (pts_to r full_perm x) (fun _ -> ())
false
Vale.SHA.SHA_helpers.fst
Vale.SHA.SHA_helpers.lemma_sha256_step2
val lemma_sha256_step2 (src1 src2: quad32) (t: counter) (block: block_w) : Lemma (requires 16 <= t /\ t < size_k_w (SHA2_256) - 3 /\ src2.hi2 == ws_opaque block (t - 2) /\ src2.hi3 == ws_opaque block (t - 1) /\ (let w = sha256_msg1_spec_t (t - 16) block in let mid = ws_quad32 (t - 7) block in src1 == add_mod_quad32 w mid)) (ensures sha256_msg2_spec src1 src2 == ws_computed_quad32 t block)
val lemma_sha256_step2 (src1 src2: quad32) (t: counter) (block: block_w) : Lemma (requires 16 <= t /\ t < size_k_w (SHA2_256) - 3 /\ src2.hi2 == ws_opaque block (t - 2) /\ src2.hi3 == ws_opaque block (t - 1) /\ (let w = sha256_msg1_spec_t (t - 16) block in let mid = ws_quad32 (t - 7) block in src1 == add_mod_quad32 w mid)) (ensures sha256_msg2_spec src1 src2 == ws_computed_quad32 t block)
let lemma_sha256_step2 (src1 src2:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) - 3 /\ src2.hi2 == ws_opaque block (t-2) /\ src2.hi3 == ws_opaque block (t-1) /\ (let w = sha256_msg1_spec_t (t-16) block in let mid = ws_quad32 (t-7) block in src1 == add_mod_quad32 w mid)) (ensures sha256_msg2_spec src1 src2 == ws_computed_quad32 t block) = sha256_msg2_spec_reveal (); let w = sha256_msg1_spec_t (t-16) block in let mid = ws_quad32 (t-7) block in let final = sha256_msg2_spec src1 src2 in lemma_ws_computed_is_ws_opaque block (t); lemma_ws_computed_is_ws_opaque block (t+1); ()
{ "file_name": "vale/code/crypto/sha/Vale.SHA.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 596, "start_col": 0, "start_line": 581 }
module Vale.SHA.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.X64.CryptoInstructions_s open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.X64.CryptoInstructions_s #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) let reveal_word () = () val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = (update_multi_opaque_aux SHA2_256 hash () blocks) let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let add_mod32 (x:word) (y:nat32) : nat32 = vv (add_mod x (to_uint32 y)) let word_to_nat32 = vv let nat32_to_word = to_uint32 let byte_to_nat8 = UInt8.v let nat8_to_byte = UInt8.uint_to_t let make_hash_def (abef cdgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abef.hi3 /\ hash.[1] == to_uint32 abef.hi2 /\ hash.[2] == to_uint32 cdgh.hi3 /\ hash.[3] == to_uint32 cdgh.hi2 /\ hash.[4] == to_uint32 abef.lo1 /\ hash.[5] == to_uint32 abef.lo0 /\ hash.[6] == to_uint32 cdgh.lo1 /\ hash.[7] == to_uint32 cdgh.lo0 } ) = let a = to_uint32 abef.hi3 in let b = to_uint32 abef.hi2 in let c = to_uint32 cdgh.hi3 in let d = to_uint32 cdgh.hi2 in let e = to_uint32 abef.lo1 in let f = to_uint32 abef.lo0 in let g = to_uint32 cdgh.lo1 in let h = to_uint32 cdgh.lo0 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; //assert_norm (index hash 2 == c); hash [@"opaque_to_smt"] let make_hash = opaque_make make_hash_def irreducible let make_hash_reveal = opaque_revealer (`%make_hash) make_hash make_hash_def let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let sha256_rnds2_spec_update_quad32 (abef cdgh:quad32) (wk:UInt32.t) : (quad32 & quad32) = let hash0 = make_hash abef cdgh in let a', b', c', d', e', f', g', h' = sha256_rnds2_spec_update hash0.[0] hash0.[1] hash0.[2] hash0.[3] hash0.[4] hash0.[5] hash0.[6] hash0.[7] wk in let abef' = Mkfour (vv f') (vv e') (vv b') (vv a') in let cdgh' = Mkfour (vv h') (vv g') (vv d') (vv c') in (abef', cdgh') let sha256_rnds2_spec_quad32 (src1 src2 wk:quad32) : quad32 = let abef', cdgh' = sha256_rnds2_spec_update_quad32 src2 src1 (to_uint32 wk.lo0) in let abef'', cdgh'' = sha256_rnds2_spec_update_quad32 abef' cdgh' (to_uint32 wk.lo1) in abef'' let lemma_sha256_rnds2_spec_quad32 (src1 src2 wk:quad32) : Lemma (sha256_rnds2_spec src1 src2 wk == sha256_rnds2_spec_quad32 src1 src2 wk) = sha256_rnds2_spec_reveal (); () let lemma_add_mod_commutes (x y:UInt32.t) : Lemma (add_mod x y == add_mod y x) = () (* let lemma_add_mod32_associates (x y z:int) : Lemma ( ((x + y % pow2_32) + z) % pow2_32 == (x + ((y + z) % pow2_32)) % pow2_32 ) = () *) let lemma_add_mod_associates_U32 (x y z:UInt32.t) : Lemma (add_mod x (add_mod y z) == add_mod (add_mod x y) z) = let open Lib.IntTypes in calc (==) { v (x +. (y +. z)); (==) { } (v x + (v y + v z) % pow2 32) % pow2 32; (==) { FStar.Math.Lemmas.lemma_mod_add_distr (v x) (v y + v z) (pow2 32) } ((v x + v y) + v z) % pow2 32; (==) { FStar.Math.Lemmas.lemma_mod_add_distr (v z) (v x + v y) (pow2 32) } ((v x + v y) % pow2 32 + v z) % pow2 32; (==) { } v ((x +. y) +. z); }; v_inj (x +. (y +. z)) ((x +. y) +. z) (* assert_norm (pow2 32 == pow2_32); //assert (add_mod y z == to_uint32 ((vv y + vv z) % pow2_32)); //assert (add_mod x (add_mod y z) == to_uint32 ((vv x + vv (to_uint32 ((vv y + vv z) % pow2_32))) % pow2_32)); lemma_add_mod32_associates (vv x) (vv y) (vv z); //assert (to_uint32 ((vv x + vv (to_uint32 ((vv y + vv z) % pow2_32))) % pow2_32) == // to_uint32 (((vv x + vv y % pow2_32) + vv z) % pow2_32)); *) #reset-options "--max_fuel 0 --max_ifuel 0" let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () let add_wrap_commutes (x y:nat32) : Lemma(add_wrap x y == add_wrap y x) = () // Walk F* through the math steps required to rearrange all of the add_mods let lemma_add_mod_a (a b c d e f g h wk:UInt32.t) : Lemma ( let u = add_mod (_Ch SHA2_256 e f g) (add_mod (_Sigma1 SHA2_256 e) (add_mod wk (add_mod h (add_mod (_Maj SHA2_256 a b c) (_Sigma0 SHA2_256 a))))) in let t1 = add_mod h (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)) in let t2 = add_mod (_Sigma0 SHA2_256 a) (_Maj SHA2_256 a b c) in let core = add_mod t1 t2 in u == core) = let t1 = add_mod h (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)) in let t2 = add_mod (_Sigma0 SHA2_256 a) (_Maj SHA2_256 a b c) in let core = add_mod t1 t2 in lemma_add_mod_commutes (_Sigma0 SHA2_256 a) (_Maj SHA2_256 a b c); assert (t2 == add_mod (_Maj SHA2_256 a b c) (_Sigma0 SHA2_256 a)); lemma_add_mod_commutes h (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)); assert (t1 == add_mod (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)) h); lemma_add_mod_associates_U32 (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)) h (add_mod (_Maj SHA2_256 a b c) (_Sigma0 SHA2_256 a)); assert (core == add_mod (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)) (add_mod h (add_mod (_Maj SHA2_256 a b c) (_Sigma0 SHA2_256 a)))); lemma_add_mod_associates_U32 (_Sigma1 SHA2_256 e) (_Ch SHA2_256 e f g) wk; // ==> add_mod (add_mod (_Sigma1 SHA2_256 e) (_Ch SHA2_256 e f g)) wk) lemma_add_mod_commutes (_Sigma1 SHA2_256 e) (_Ch SHA2_256 e f g); // ==> add_mod (add_mod (_Ch SHA2_256 e f g) (_Sigma1 SHA2_256 e)) wk) lemma_add_mod_associates_U32 (add_mod (_Ch SHA2_256 e f g) (_Sigma1 SHA2_256 e)) wk (add_mod h (add_mod (_Maj SHA2_256 a b c) (_Sigma0 SHA2_256 a))); assert (core == add_mod (add_mod (_Ch SHA2_256 e f g) (_Sigma1 SHA2_256 e)) (add_mod wk (add_mod h (add_mod (_Maj SHA2_256 a b c) (_Sigma0 SHA2_256 a))))); lemma_add_mod_associates_U32 (_Ch SHA2_256 e f g) (_Sigma1 SHA2_256 e) (add_mod wk (add_mod h (add_mod (_Maj SHA2_256 a b c) (_Sigma0 SHA2_256 a)))); () let lemma_add_mod_e (a b c d e f g h wk:UInt32.t) : Lemma ( let u = add_mod (_Ch SHA2_256 e f g) (add_mod (_Sigma1 SHA2_256 e) (add_mod wk (add_mod h d))) in let t1 = add_mod h (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)) in let core = add_mod d t1 in u == core) = let t1 = add_mod h (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)) in let core = add_mod d t1 in lemma_add_mod_commutes h (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)); // t1 == add_mod (add_mod (_Sigma1 SHA2_256 e) (add_mod (_Ch SHA2_256 e f g) wk)) h); lemma_add_mod_commutes d t1; // core == add_mod t1 d lemma_add_mod_associates_U32 (_Sigma1 SHA2_256 e) (_Ch SHA2_256 e f g) wk; assert (t1 == add_mod (add_mod (add_mod (_Sigma1 SHA2_256 e) (_Ch SHA2_256 e f g)) wk) h); lemma_add_mod_associates_U32 (add_mod (add_mod (_Sigma1 SHA2_256 e) (_Ch SHA2_256 e f g)) wk) h d; assert (core == add_mod (add_mod (add_mod (_Sigma1 SHA2_256 e) (_Ch SHA2_256 e f g)) wk) (add_mod h d)); lemma_add_mod_associates_U32 (add_mod (_Sigma1 SHA2_256 e) (_Ch SHA2_256 e f g)) wk (add_mod h d); assert (core == add_mod (add_mod (_Sigma1 SHA2_256 e) (_Ch SHA2_256 e f g)) (add_mod wk (add_mod h d))); lemma_add_mod_associates_U32 (_Ch SHA2_256 e f g) (_Sigma1 SHA2_256 e) (add_mod wk (add_mod h d)); assert (core == add_mod (_Ch SHA2_256 e f g) (add_mod (_Sigma1 SHA2_256 e) (add_mod wk (add_mod h d)))); () let lemma_sha256_rnds2_spec_update_is_shuffle_core (hash:hash256) (wk:UInt32.t) (t:counter) (block:block_w) : Lemma (requires t < size_k_w SHA2_256 /\ wk == to_uint32 (add_mod32 (k0 SHA2_256).[t] (ws_opaque block t))) (ensures (let a', b', c', d', e', f', g', h' = sha256_rnds2_spec_update hash.[0] hash.[1] hash.[2] hash.[3] hash.[4] hash.[5] hash.[6] hash.[7] wk in let u = seq_of_list [a'; b'; c'; d'; e'; f'; g'; h'] in let c = shuffle_core_opaque block hash t in u == c)) = let a', b', c', d', e', f', g', h' = sha256_rnds2_spec_update hash.[0] hash.[1] hash.[2] hash.[3] hash.[4] hash.[5] hash.[6] hash.[7] wk in let l:list Lib.IntTypes.uint32 = [a'; b'; c'; d'; e'; f'; g'; h'] in let u:Seq.seq UInt32.t = seq_of_list l in assert_norm (List.length l == 8); let c = shuffle_core_opaque block hash t in Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; Pervasives.reveal_opaque (`%ws) ws; shuffle_core_properties block hash t; elim_of_list l; Classical.forall_intro_3 lemma_add_mod_associates_U32; lemma_add_mod_a hash.[0] hash.[1] hash.[2] hash.[3] hash.[4] hash.[5] hash.[6] hash.[7] wk; lemma_add_mod_e hash.[0] hash.[1] hash.[2] hash.[3] hash.[4] hash.[5] hash.[6] hash.[7] wk let sha256_rnds2_spec_update_core_quad32 (abef cdgh:quad32) (wk:UInt32.t) (block:block_w) (t:counter{t < size_k_w_256}) : (quad32 & quad32) = let hash0 = make_hash abef cdgh in let hash1 = shuffle_core_opaque block hash0 t in let abef' = Mkfour (vv hash1.[5]) (vv hash1.[4]) (vv hash1.[1]) (vv hash1.[0]) in let cdgh' = Mkfour (vv hash1.[7]) (vv hash1.[6]) (vv hash1.[3]) (vv hash1.[2]) in (abef', cdgh') let lemma_rnds_quad32 (abef cdgh:quad32) (wk:UInt32.t) (block:block_w) (t:counter{t < size_k_w_256}) : Lemma (requires wk == to_uint32 (add_mod32 (k0 SHA2_256).[t] (ws_opaque block t))) (ensures sha256_rnds2_spec_update_core_quad32 abef cdgh wk block t == sha256_rnds2_spec_update_quad32 abef cdgh wk) = let hash0 = make_hash abef cdgh in let hash1 = shuffle_core_opaque block hash0 t in let a', b', c', d', e', f', g', h' = sha256_rnds2_spec_update hash0.[0] hash0.[1] hash0.[2] hash0.[3] hash0.[4] hash0.[5] hash0.[6] hash0.[7] wk in let l = [a'; b'; c'; d'; e'; f'; g'; h'] in elim_of_list l; lemma_sha256_rnds2_spec_update_is_shuffle_core hash0 wk t block; () #push-options "--z3rlimit 30" let lemma_rnds2_spec_quad32_is_shuffle_core_x2 (abef cdgh:quad32) (wk0 wk1:UInt32.t) (block:block_w) (t:counter{t < size_k_w_256 - 1}) : Lemma (requires vv wk0 == add_mod32 (k0 SHA2_256).[t] (ws_opaque block t) /\ vv wk1 == add_mod32 (k0 SHA2_256).[t+1] (ws_opaque block (t+1))) (ensures (let hash0 = make_hash abef cdgh in let hash1 = shuffle_core_opaque block hash0 t in let hash2 = shuffle_core_opaque block hash1 (t + 1) in let abef', cdgh' = sha256_rnds2_spec_update_quad32 abef cdgh wk0 in let abef'', cdgh'' = sha256_rnds2_spec_update_quad32 abef' cdgh' wk1 in hash2 == make_hash abef'' cdgh'')) = let hash0 = make_hash abef cdgh in let hash1 = shuffle_core_opaque block hash0 t in let hash2 = shuffle_core_opaque block hash1 (t + 1) in let abef', cdgh' = sha256_rnds2_spec_update_quad32 abef cdgh wk0 in let abef'', cdgh'' = sha256_rnds2_spec_update_quad32 abef' cdgh' wk1 in lemma_rnds_quad32 abef cdgh wk0 block t; lemma_rnds_quad32 abef' cdgh' wk1 block (t+1); assert (equal (make_hash abef' cdgh') hash1); assert (equal (make_hash abef'' cdgh'') hash2); () #pop-options let sha256_rnds2_spec_update_quad32_x2_shifts (abef cdgh:quad32) (wk0 wk1:UInt32.t) : Lemma ((let abef', cdgh' = sha256_rnds2_spec_update_quad32 abef cdgh wk0 in let abef'', cdgh'' = sha256_rnds2_spec_update_quad32 abef' cdgh' wk1 in cdgh'' == abef)) = () let sha256_rnds2_spec_quad32_is_shuffle_core_x2 (abef cdgh wk:quad32) (block:block_w) (t:counter{t < size_k_w_256 - 1}) : Lemma (requires wk.lo0 == add_mod32 (k0 SHA2_256).[t] (ws_opaque block t) /\ wk.lo1 == add_mod32 (k0 SHA2_256).[t+1] (ws_opaque block (t+1))) (ensures (let hash0 = make_hash abef cdgh in let hash1 = shuffle_core_opaque block hash0 t in let hash2 = shuffle_core_opaque block hash1 (t + 1) in let abef' = sha256_rnds2_spec_quad32 cdgh abef wk in hash2 == make_hash abef' abef)) = lemma_rnds2_spec_quad32_is_shuffle_core_x2 abef cdgh (to_uint32 wk.lo0) (to_uint32 wk.lo1) block t; sha256_rnds2_spec_update_quad32_x2_shifts abef cdgh (to_uint32 wk.lo0) (to_uint32 wk.lo1); () let lemma_sha256_rnds2_two_steps (abef cdgh xmm0:quad32) (t:counter) (block:block_w) : Lemma (requires t + 1 < size_k_w_256 /\ xmm0.lo0 == add_wrap (vv (k0 SHA2_256).[t] ) (ws_opaque block t) /\ xmm0.lo1 == add_wrap (vv (k0 SHA2_256).[t+1]) (ws_opaque block (t+1)) ) (ensures (let hash0 = make_hash abef cdgh in let hash1 = shuffle_core_opaque block hash0 t in let hash2 = shuffle_core_opaque block hash1 (t + 1) in hash2 == make_hash (sha256_rnds2_spec cdgh abef xmm0) abef)) = let hash0 = make_hash abef cdgh in let hash1 = shuffle_core_opaque block hash0 t in let hash2 = shuffle_core_opaque block hash1 (t + 1) in lemma_add_wrap_is_add_mod (vv (k0 SHA2_256).[t] ) (ws_opaque block t); lemma_add_wrap_is_add_mod (vv (k0 SHA2_256).[t+1]) (ws_opaque block (t+1)); sha256_rnds2_spec_quad32_is_shuffle_core_x2 abef cdgh xmm0 block t; lemma_sha256_rnds2_spec_quad32 cdgh abef xmm0; () // Top-level proof for the SHA256_rnds2 instruction let lemma_sha256_rnds2 (abef cdgh xmm0:quad32) (t:counter) (block:block_w) (hash_in:hash256) : Lemma (requires t + 1 < size_k_w_256 /\ xmm0.lo0 == add_wrap (word_to_nat32 k.[t]) (ws_opaque block t) /\ xmm0.lo1 == add_wrap (word_to_nat32 k.[t+1]) (ws_opaque block (t+1)) /\ make_hash abef cdgh == Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_in ) (ensures make_hash (sha256_rnds2_spec cdgh abef xmm0) abef == Spec.Loops.repeat_range 0 (t+2) (shuffle_core_opaque block) hash_in) = lemma_add_wrap_is_add_mod (vv (k0 SHA2_256).[t] ) (ws_opaque block t); lemma_add_wrap_is_add_mod (vv (k0 SHA2_256).[t+1]) (ws_opaque block (t+1)); lemma_sha256_rnds2_two_steps abef cdgh xmm0 t block; Spec.Loops.repeat_range_induction 0 (t + 1) (shuffle_core_opaque block) hash_in; Spec.Loops.repeat_range_induction 0 (t + 2) (shuffle_core_opaque block) hash_in; () (* Proof work for the SHA256_msg* instructions *) let _sigma0_quad32 (q:quad32) : quad32 = Mkfour (vv (_sigma0 SHA2_256 (to_uint32 q.lo0))) (vv (_sigma0 SHA2_256 (to_uint32 q.lo1))) (vv (_sigma0 SHA2_256 (to_uint32 q.hi2))) (vv (_sigma0 SHA2_256 (to_uint32 q.hi3))) let _sigma1_quad32 (q:quad32) : quad32 = Mkfour (vv (_sigma1 SHA2_256 (to_uint32 q.lo0))) (vv (_sigma1 SHA2_256 (to_uint32 q.lo1))) (vv (_sigma1 SHA2_256 (to_uint32 q.hi2))) (vv (_sigma1 SHA2_256 (to_uint32 q.hi3))) let ws_partial_def (t:counter) (block:block_w) : quad32 = if 16 <= t && t < size_k_w_256 then (let init = ws_quad32 (t-16) block in let sigma0_in = ws_quad32 (t-15) block in let sigma0_out = _sigma0_quad32 sigma0_in in add_wrap_quad32 init sigma0_out) else Mkfour 0 0 0 0 let add_mod_quad32 (q0 q1:quad32) : quad32 = Mkfour (vv (add_mod (to_uint32 q0.lo0) (to_uint32 q1.lo0))) (vv (add_mod (to_uint32 q0.lo1) (to_uint32 q1.lo1))) (vv (add_mod (to_uint32 q0.hi2) (to_uint32 q1.hi2))) (vv (add_mod (to_uint32 q0.hi3) (to_uint32 q1.hi3))) let lemma_add_wrap_quad32_is_add_mod_quad32 (q0 q1:quad32) : Lemma (add_mod_quad32 q0 q1 == add_wrap_quad32 q0 q1) = FStar.Classical.forall_intro_2 lemma_add_wrap_is_add_mod; () #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" // Top-level proof for the SHA256_msg1 instruction let lemma_sha256_msg1 (dst src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ dst == ws_quad32 (t-16) block /\ src.lo0 == ws_opaque block (t-12)) (ensures sha256_msg1_spec dst src == ws_partial t block) = sha256_msg1_spec_reveal (); let init = ws_quad32 (t-16) block in let sigma0_in = ws_quad32 (t-15) block in let sigma0_out = _sigma0_quad32 sigma0_in in lemma_add_wrap_quad32_is_add_mod_quad32 init sigma0_out; ws_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let lemma_add_mod_ws_rearrangement (a b c d:UInt32.t) : Lemma (let open Lib.IntTypes in a +. b +. c +. d == d +. c +. b +. a) = let open Lib.IntTypes in calc (==) { a +. b +. c +. d; (==) {} (((a +. b) +. c) +. d); (==) { lemma_add_mod_commutes ((a +. b) +. c) d; lemma_add_mod_commutes (a +. b) c; lemma_add_mod_commutes a b } d +. (c +. (b +. a)); (==) { lemma_add_mod_associates_U32 d c (b +. a); lemma_add_mod_associates_U32 (d +. c) b a} (((d +. c) +. b) +. a); } let ws_computed (b:block_w) (t:counter{t < size_k_w_256}): Tot (UInt32.t) = if t < block_word_length SHA2_256 then to_uint32 (ws_opaque b t) else let t16 = to_uint32 (ws_opaque b (t - 16)) in let t15 = to_uint32 (ws_opaque b (t - 15)) in let t7 = to_uint32 (ws_opaque b (t - 7)) in let t2 = to_uint32 (ws_opaque b (t - 2)) in let s1 = _sigma1 SHA2_256 t2 in let s0 = _sigma0 SHA2_256 t15 in let open Lib.IntTypes in (t16 +. s0 +. t7 +. s1) #push-options "--max_fuel 1" let lemma_ws_computed_is_ws (b:block_w) (t:counter{t < size_k_w_256}) : Lemma (ws_computed b t == ws SHA2_256 b t) = Pervasives.reveal_opaque (`%ws) ws; if t < block_word_length SHA2_256 then ( assert (vv (ws_computed b t) == ws_opaque b t); assert (to_uint32 (ws_opaque b t) == ws SHA2_256 b t); () ) else ( let t16 = to_uint32 (ws_opaque b (t - 16)) in let t15 = to_uint32 (ws_opaque b (t - 15)) in let t7 = to_uint32 (ws_opaque b (t - 7)) in let t2 = to_uint32 (ws_opaque b (t - 2)) in let s1 = _sigma1 SHA2_256 t2 in let s0 = _sigma0 SHA2_256 t15 in lemma_add_mod_ws_rearrangement s1 t7 s0 t16; () ) #pop-options let lemma_ws_computed_is_ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : Lemma (vv (ws_computed b t) == ws_opaque b t) = lemma_ws_computed_is_ws b t; Pervasives.reveal_opaque (`%ws) ws; () let ws_computed_quad32 (t:counter{t < size_k_w_256 - 3}) (block:block_w) : quad32 = Mkfour (vv (ws_computed block t)) (vv (ws_computed block (t+1))) (vv (ws_computed block (t+2))) (vv (ws_computed block (t+3))) let lemma_ws_computed_is_ws_quad32 (b:block_w) (t:counter{t < size_k_w_256 - 3}) : Lemma (ws_computed_quad32 t b == ws_quad32 t b) = let w = ws_computed_quad32 t b in let w' = ws_quad32 t b in lemma_ws_computed_is_ws_opaque b t; lemma_ws_computed_is_ws_opaque b (t+1); lemma_ws_computed_is_ws_opaque b (t+2); lemma_ws_computed_is_ws_opaque b (t+3); () #push-options "--z3rlimit 30" let lemma_ws_computed_quad32 (t:counter{16 <= t /\ t < size_k_w_256 - 4}) (block:block_w) : Lemma (let t_minus_16 = ws_quad32 (t-16) block in let t_minus_15 = ws_quad32 (t-15) block in let t_minus_7 = ws_quad32 (t - 7) block in let t_minus_2 = ws_quad32 (t - 2) block in let m1 = add_mod_quad32 t_minus_16 (_sigma0_quad32 t_minus_15) in let m2 = add_mod_quad32 m1 t_minus_7 in let m3 = add_mod_quad32 m2 (_sigma1_quad32 t_minus_2) in m3 == ws_computed_quad32 t block ) = () #pop-options let sha256_msg1_spec_t (t:counter{t < size_k_w_256 - 1}) (block:block_w) : quad32 = let init = ws_quad32 t block in let next = ws_quad32 (t + 1) block in let msg1 = add_mod_quad32 init (_sigma0_quad32 next) in msg1 #push-options "--ifuel 1" let lemma_sha256_msg1_spec_t_partial (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w_256 - 3) (ensures ws_partial t block == sha256_msg1_spec_t (t-16) block) = ws_partial_reveal (); let init = ws_quad32 (t-16) block in let next = ws_quad32 (t-15) block in lemma_add_wrap_quad32_is_add_mod_quad32 init (_sigma0_quad32 next); () #pop-options let lemma_sha256_msg1_spec_t (src1 src2:quad32) (t:counter) (block:block_w) : Lemma (requires t < size_k_w_256 - 4 /\ src1 == ws_quad32 t block /\ src2.lo0 == ws_opaque block (t+4)) (ensures sha256_msg1_spec_t t block == sha256_msg1_spec src1 src2) = sha256_msg1_spec_reveal (); ()
{ "checked_file": "/", "dependencies": [ "Vale.X64.CryptoInstructions_s.fst.checked", "Vale.X64.CryptoInstructions_s.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 70, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
src1: Vale.Def.Types_s.quad32 -> src2: Vale.Def.Types_s.quad32 -> t: Vale.SHA.SHA_helpers.counter -> block: Vale.SHA.SHA_helpers.block_w -> FStar.Pervasives.Lemma (requires 16 <= t /\ t < Spec.SHA2.size_k_w Spec.Hash.Definitions.SHA2_256 - 3 /\ Mkfour?.hi2 src2 == Vale.SHA.SHA_helpers.ws_opaque block (t - 2) /\ Mkfour?.hi3 src2 == Vale.SHA.SHA_helpers.ws_opaque block (t - 1) /\ (let w = Vale.SHA.SHA_helpers.sha256_msg1_spec_t (t - 16) block in let mid = Vale.SHA.SHA_helpers.ws_quad32 (t - 7) block in src1 == Vale.SHA.SHA_helpers.add_mod_quad32 w mid)) (ensures Vale.X64.CryptoInstructions_s.sha256_msg2_spec src1 src2 == Vale.SHA.SHA_helpers.ws_computed_quad32 t block)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Types_s.quad32", "Vale.SHA.SHA_helpers.counter", "Vale.SHA.SHA_helpers.block_w", "Prims.unit", "Vale.SHA.SHA_helpers.lemma_ws_computed_is_ws_opaque", "Prims.op_Addition", "Vale.X64.CryptoInstructions_s.sha256_msg2_spec", "Vale.SHA.SHA_helpers.ws_quad32", "Prims.op_Subtraction", "Vale.SHA.SHA_helpers.sha256_msg1_spec_t", "Vale.X64.CryptoInstructions_s.sha256_msg2_spec_reveal", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Spec.SHA2.size_k_w", "Spec.Hash.Definitions.SHA2_256", "Prims.eq2", "Vale.Def.Words_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__hi2", "Vale.Def.Types_s.nat32", "Vale.SHA.SHA_helpers.ws_opaque", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.SHA.SHA_helpers.add_mod_quad32", "Prims.squash", "Vale.SHA.SHA_helpers.ws_computed_quad32", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_sha256_step2 (src1 src2: quad32) (t: counter) (block: block_w) : Lemma (requires 16 <= t /\ t < size_k_w (SHA2_256) - 3 /\ src2.hi2 == ws_opaque block (t - 2) /\ src2.hi3 == ws_opaque block (t - 1) /\ (let w = sha256_msg1_spec_t (t - 16) block in let mid = ws_quad32 (t - 7) block in src1 == add_mod_quad32 w mid)) (ensures sha256_msg2_spec src1 src2 == ws_computed_quad32 t block) =
sha256_msg2_spec_reveal (); let w = sha256_msg1_spec_t (t - 16) block in let mid = ws_quad32 (t - 7) block in let final = sha256_msg2_spec src1 src2 in lemma_ws_computed_is_ws_opaque block (t); lemma_ws_computed_is_ws_opaque block (t + 1); ()
false
Steel.MonotonicReference.fst
Steel.MonotonicReference.alloc
val alloc (#a:Type) (p:Preorder.preorder a) (v:a) : SteelT (ref a p) emp (fun r -> pts_to r full_perm v)
val alloc (#a:Type) (p:Preorder.preorder a) (v:a) : SteelT (ref a p) emp (fun r -> pts_to r full_perm v)
let alloc (#a:Type) (p:Preorder.preorder a) (v:a) : SteelT (ref a p) emp (fun r -> pts_to r full_perm v) = let r = MHR.alloc (raise_preorder p) (U.raise_val v) in rewrite_slprop (MHR.pts_to r full_perm (hide (U.raise_val v))) (pts_to r full_perm v) (fun _ -> ()); return r
{ "file_name": "lib/steel/Steel.MonotonicReference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 12, "end_line": 54, "start_col": 0, "start_line": 47 }
(* Copyright 2020 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 Steel.MonotonicReference open FStar.PCM open FStar.Ghost open Steel.FractionalPermission open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Preorder = FStar.Preorder module MHR = Steel.MonotonicHigherReference module U = FStar.Universe let raise_preorder (#a:Type0) (p:Preorder.preorder a) : Preorder.preorder (U.raise_t a) = fun (x0 x1:U.raise_t a) -> p (U.downgrade_val x0) (U.downgrade_val x1) let ref a p = MHR.ref (FStar.Universe.raise_t a) (raise_preorder p) /// The standard points to separation logic predicate let pts_to_sl (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:a) = MHR.pts_to_sl r f (hide (U.raise_val v)) /// Allocates a reference with value [x]. We have full permission on the newly
{ "checked_file": "/", "dependencies": [ "Steel.MonotonicHigherReference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.PCM.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Steel.MonotonicReference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.MonotonicHigherReference", "short_module": "MHR" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "FStar.PCM", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: FStar.Preorder.preorder a -> v: a -> Steel.Effect.SteelT (Steel.MonotonicReference.ref a p)
Steel.Effect.SteelT
[]
[]
[ "FStar.Preorder.preorder", "Steel.Effect.Atomic.return", "Steel.MonotonicReference.ref", "FStar.Ghost.hide", "FStar.Set.set", "Steel.Memory.iname", "FStar.Set.empty", "Steel.MonotonicReference.pts_to", "Steel.FractionalPermission.full_perm", "Steel.Effect.Common.vprop", "Prims.unit", "Steel.Effect.Atomic.rewrite_slprop", "Steel.MonotonicHigherReference.pts_to", "FStar.Universe.raise_t", "Steel.MonotonicReference.raise_preorder", "FStar.Universe.raise_val", "Steel.Memory.mem", "Steel.MonotonicHigherReference.ref", "Steel.MonotonicHigherReference.alloc", "Steel.Effect.Common.emp" ]
[]
false
true
false
false
false
let alloc (#a: Type) (p: Preorder.preorder a) (v: a) : SteelT (ref a p) emp (fun r -> pts_to r full_perm v) =
let r = MHR.alloc (raise_preorder p) (U.raise_val v) in rewrite_slprop (MHR.pts_to r full_perm (hide (U.raise_val v))) (pts_to r full_perm v) (fun _ -> ()); return r
false
Hacl.Impl.Store56.fst
Hacl.Impl.Store56.lemma_nat_from_bytes_le_append
val lemma_nat_from_bytes_le_append (k1 k2: bytes) : Lemma (requires Seq.length k1 + Seq.length k2 <= max_size_t) (ensures nat_from_bytes_le (Seq.append k1 k2) == nat_from_bytes_le k1 + pow2 (Seq.length k1 * 8) * nat_from_bytes_le k2)
val lemma_nat_from_bytes_le_append (k1 k2: bytes) : Lemma (requires Seq.length k1 + Seq.length k2 <= max_size_t) (ensures nat_from_bytes_le (Seq.append k1 k2) == nat_from_bytes_le k1 + pow2 (Seq.length k1 * 8) * nat_from_bytes_le k2)
let lemma_nat_from_bytes_le_append (k1 k2:bytes) : Lemma (requires Seq.length k1 + Seq.length k2 <= max_size_t) (ensures nat_from_bytes_le (Seq.append k1 k2) == nat_from_bytes_le k1 + pow2 (Seq.length k1 * 8) * nat_from_bytes_le k2) = let k = Seq.append k1 k2 in let n = Seq.length k1 + Seq.length k2 in nat_from_intseq_le_slice_lemma #U8 #SEC #n k (Seq.length k1); assert (k1 `Seq.equal` Seq.slice k 0 (Seq.length k1)); assert (k2 `Seq.equal` Seq.slice k (Seq.length k1) n)
{ "file_name": "code/ed25519/Hacl.Impl.Store56.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 55, "end_line": 67, "start_col": 0, "start_line": 59 }
module Hacl.Impl.Store56 module ST = FStar.HyperStack.ST open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.ByteSequence open Lib.Buffer open Lib.ByteBuffer module F56 = Hacl.Impl.BignumQ.Mul module S56 = Hacl.Spec.BignumQ.Definitions #reset-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val hstore56_le: out:lbuffer uint8 32ul -> off:size_t{v off <= 21} -> x:uint64{v x < pow2 56} -> Stack unit (requires fun h -> live h out) (ensures fun h0 _ h1 -> modifies (loc (gsub out off 8ul)) h0 h1 /\ nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)) == v x ) let hstore56_le out off x = let b8 = sub out off 8ul in lemma_uint_to_bytes_le_preserves_value x; uint_to_bytes_le b8 x; let h1 = ST.get() in calc (==) { v x <: nat; (==) { Math.Lemmas.small_mod (v x) (pow2 56) } (v x) % pow2 56 <: nat; (==) { assert (Seq.equal (as_seq h1 b8) (Seq.slice (as_seq h1 out) (v off) (v off + 8))) } (nat_from_bytes_le (as_seq h1 b8)) % pow2 56; (==) { nat_from_intseq_le_slice_lemma (as_seq h1 b8) 7 } (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) + pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) % pow2 56; (==) { Math.Lemmas.lemma_mod_plus_distr_r (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.swap_mul (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.cancel_mul_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56) } nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) % pow2 56; (==) { Math.Lemmas.small_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56); assert (Seq.equal (Seq.slice (as_seq h1 b8) 0 7) (Seq.slice (as_seq h1 out) (v off) (v off + 7))) } nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)); }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.BignumQ.Definitions.fst.checked", "Hacl.Impl.BignumQ.Mul.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Store56.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.BignumQ.Definitions", "short_module": "S56" }, { "abbrev": true, "full_module": "Hacl.Impl.BignumQ.Mul", "short_module": "F56" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "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": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k1: Lib.ByteSequence.bytes -> k2: Lib.ByteSequence.bytes -> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length k1 + FStar.Seq.Base.length k2 <= Lib.IntTypes.max_size_t) (ensures Lib.ByteSequence.nat_from_bytes_le (FStar.Seq.Base.append k1 k2) == Lib.ByteSequence.nat_from_bytes_le k1 + Prims.pow2 (FStar.Seq.Base.length k1 * 8) * Lib.ByteSequence.nat_from_bytes_le k2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Lib.ByteSequence.bytes", "Prims._assert", "FStar.Seq.Base.equal", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "FStar.Seq.Base.slice", "FStar.Seq.Base.length", "Prims.unit", "Lib.ByteSequence.nat_from_intseq_le_slice_lemma", "Prims.int", "Prims.op_Addition", "FStar.Seq.Base.seq", "Lib.IntTypes.int_t", "FStar.Seq.Base.append", "Prims.b2t", "Prims.op_LessThanOrEqual", "Lib.IntTypes.max_size_t", "Prims.squash", "Prims.eq2", "Lib.ByteSequence.nat_from_bytes_le", "FStar.Mul.op_Star", "Prims.pow2", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_nat_from_bytes_le_append (k1 k2: bytes) : Lemma (requires Seq.length k1 + Seq.length k2 <= max_size_t) (ensures nat_from_bytes_le (Seq.append k1 k2) == nat_from_bytes_le k1 + pow2 (Seq.length k1 * 8) * nat_from_bytes_le k2) =
let k = Seq.append k1 k2 in let n = Seq.length k1 + Seq.length k2 in nat_from_intseq_le_slice_lemma #U8 #SEC #n k (Seq.length k1); assert (k1 `Seq.equal` (Seq.slice k 0 (Seq.length k1))); assert (k2 `Seq.equal` (Seq.slice k (Seq.length k1) n))
false
PulseCore.FractionalPermission.fst
PulseCore.FractionalPermission.writeable
val writeable (p: perm) : GTot bool
val writeable (p: perm) : GTot bool
let writeable (p: perm) : GTot bool = MkPerm?.v p = one
{ "file_name": "lib/pulse_core/PulseCore.FractionalPermission.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 19, "end_line": 33, "start_col": 0, "start_line": 32 }
(* Copyright 2020 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 PulseCore.FractionalPermission open FStar.Real /// This module defines fractional permissions, to be used with Steel references /// A fractional permission is a real value between 0 (excluded) and 1. /// 1 represents full ownership, while any fraction corresponds to a shared /// permission. /// Note: Does not use real literals, but rather the wrappers one, zero, two, … /// Real literals are currently not supported by Meta-F*'s reflection framework [@@erasable] noeq type perm : Type0 = | MkPerm: v:real{ v >. zero } -> perm
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Real.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "PulseCore.FractionalPermission.fst" }
[ { "abbrev": false, "full_module": "FStar.Real", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: PulseCore.FractionalPermission.perm -> Prims.GTot Prims.bool
Prims.GTot
[ "sometrivial" ]
[]
[ "PulseCore.FractionalPermission.perm", "Prims.op_Equality", "FStar.Real.real", "PulseCore.FractionalPermission.__proj__MkPerm__item__v", "FStar.Real.one", "Prims.bool" ]
[]
false
false
false
false
false
let writeable (p: perm) : GTot bool =
MkPerm?.v p = one
false
Hacl.Impl.Store56.fst
Hacl.Impl.Store56.hstore56_le
val hstore56_le: out:lbuffer uint8 32ul -> off:size_t{v off <= 21} -> x:uint64{v x < pow2 56} -> Stack unit (requires fun h -> live h out) (ensures fun h0 _ h1 -> modifies (loc (gsub out off 8ul)) h0 h1 /\ nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)) == v x )
val hstore56_le: out:lbuffer uint8 32ul -> off:size_t{v off <= 21} -> x:uint64{v x < pow2 56} -> Stack unit (requires fun h -> live h out) (ensures fun h0 _ h1 -> modifies (loc (gsub out off 8ul)) h0 h1 /\ nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)) == v x )
let hstore56_le out off x = let b8 = sub out off 8ul in lemma_uint_to_bytes_le_preserves_value x; uint_to_bytes_le b8 x; let h1 = ST.get() in calc (==) { v x <: nat; (==) { Math.Lemmas.small_mod (v x) (pow2 56) } (v x) % pow2 56 <: nat; (==) { assert (Seq.equal (as_seq h1 b8) (Seq.slice (as_seq h1 out) (v off) (v off + 8))) } (nat_from_bytes_le (as_seq h1 b8)) % pow2 56; (==) { nat_from_intseq_le_slice_lemma (as_seq h1 b8) 7 } (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) + pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) % pow2 56; (==) { Math.Lemmas.lemma_mod_plus_distr_r (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.swap_mul (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.cancel_mul_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56) } nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) % pow2 56; (==) { Math.Lemmas.small_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56); assert (Seq.equal (Seq.slice (as_seq h1 b8) 0 7) (Seq.slice (as_seq h1 out) (v off) (v off + 7))) } nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)); }
{ "file_name": "code/ed25519/Hacl.Impl.Store56.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 57, "start_col": 0, "start_line": 28 }
module Hacl.Impl.Store56 module ST = FStar.HyperStack.ST open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.ByteSequence open Lib.Buffer open Lib.ByteBuffer module F56 = Hacl.Impl.BignumQ.Mul module S56 = Hacl.Spec.BignumQ.Definitions #reset-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val hstore56_le: out:lbuffer uint8 32ul -> off:size_t{v off <= 21} -> x:uint64{v x < pow2 56} -> Stack unit (requires fun h -> live h out) (ensures fun h0 _ h1 -> modifies (loc (gsub out off 8ul)) h0 h1 /\ nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)) == v x )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.BignumQ.Definitions.fst.checked", "Hacl.Impl.BignumQ.Mul.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Store56.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.BignumQ.Definitions", "short_module": "S56" }, { "abbrev": true, "full_module": "Hacl.Impl.BignumQ.Mul", "short_module": "F56" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "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": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> off: Lib.IntTypes.size_t{Lib.IntTypes.v off <= 21} -> x: Lib.IntTypes.uint64{Lib.IntTypes.v x < Prims.pow2 56} -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThanOrEqual", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.IntTypes.uint64", "Prims.op_LessThan", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Prims.pow2", "FStar.Calc.calc_finish", "Prims.nat", "Prims.eq2", "Lib.ByteSequence.nat_from_bytes_le", "FStar.Seq.Base.slice", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Prims.op_Addition", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "Prims.op_Modulus", "FStar.Mul.op_Star", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.small_mod", "Prims.squash", "Prims._assert", "FStar.Seq.Base.equal", "Lib.ByteSequence.nat_from_intseq_le_slice_lemma", "Lib.IntTypes.U8", "FStar.Math.Lemmas.cancel_mul_mod", "FStar.Math.Lemmas.swap_mul", "FStar.Math.Lemmas.lemma_mod_plus_distr_r", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Lib.ByteBuffer.uint_to_bytes_le", "Lib.ByteSequence.lemma_uint_to_bytes_le_preserves_value", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Lib.Buffer.sub" ]
[]
false
true
false
false
false
let hstore56_le out off x =
let b8 = sub out off 8ul in lemma_uint_to_bytes_le_preserves_value x; uint_to_bytes_le b8 x; let h1 = ST.get () in calc ( == ) { v x <: nat; ( == ) { Math.Lemmas.small_mod (v x) (pow2 56) } (v x) % pow2 56 <: nat; ( == ) { assert (Seq.equal (as_seq h1 b8) (Seq.slice (as_seq h1 out) (v off) (v off + 8))) } (nat_from_bytes_le (as_seq h1 b8)) % pow2 56; ( == ) { nat_from_intseq_le_slice_lemma (as_seq h1 b8) 7 } (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) + pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) % pow2 56; ( == ) { (Math.Lemmas.lemma_mod_plus_distr_r (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.swap_mul (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.cancel_mul_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56)) } nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) % pow2 56; ( == ) { (Math.Lemmas.small_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56); assert (Seq.equal (Seq.slice (as_seq h1 b8) 0 7) (Seq.slice (as_seq h1 out) (v off) (v off + 7)) )) } nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)); }
false
PulseCore.FractionalPermission.fst
PulseCore.FractionalPermission.lesser_perm
val lesser_perm (p1 p2: perm) : GTot bool
val lesser_perm (p1 p2: perm) : GTot bool
let lesser_perm (p1 p2:perm) : GTot bool = MkPerm?.v p1 <. MkPerm?.v p2
{ "file_name": "lib/pulse_core/PulseCore.FractionalPermission.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 31, "end_line": 48, "start_col": 0, "start_line": 47 }
(* Copyright 2020 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 PulseCore.FractionalPermission open FStar.Real /// This module defines fractional permissions, to be used with Steel references /// A fractional permission is a real value between 0 (excluded) and 1. /// 1 represents full ownership, while any fraction corresponds to a shared /// permission. /// Note: Does not use real literals, but rather the wrappers one, zero, two, … /// Real literals are currently not supported by Meta-F*'s reflection framework [@@erasable] noeq type perm : Type0 = | MkPerm: v:real{ v >. zero } -> perm /// A reference is only safely writeable if we have full permission let writeable (p: perm) : GTot bool = MkPerm?.v p = one /// Helper around splitting a permission in half let half_perm (p: perm) : Tot perm = MkPerm ((MkPerm?.v p) /. two) /// Helper to combine two permissions into one let sum_perm (p1 p2: perm) : Tot perm = MkPerm (MkPerm?.v p1 +. MkPerm?.v p2) /// Helper to compare two permissions let lesser_equal_perm (p1 p2:perm) : GTot bool = MkPerm?.v p1 <=. MkPerm?.v p2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Real.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "PulseCore.FractionalPermission.fst" }
[ { "abbrev": false, "full_module": "FStar.Real", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p1: PulseCore.FractionalPermission.perm -> p2: PulseCore.FractionalPermission.perm -> Prims.GTot Prims.bool
Prims.GTot
[ "sometrivial" ]
[]
[ "PulseCore.FractionalPermission.perm", "FStar.Real.op_Less_Dot", "PulseCore.FractionalPermission.__proj__MkPerm__item__v", "Prims.bool" ]
[]
false
false
false
false
false
let lesser_perm (p1 p2: perm) : GTot bool =
MkPerm?.v p1 <. MkPerm?.v p2
false
PulseCore.FractionalPermission.fst
PulseCore.FractionalPermission.lesser_equal_perm
val lesser_equal_perm (p1 p2: perm) : GTot bool
val lesser_equal_perm (p1 p2: perm) : GTot bool
let lesser_equal_perm (p1 p2:perm) : GTot bool = MkPerm?.v p1 <=. MkPerm?.v p2
{ "file_name": "lib/pulse_core/PulseCore.FractionalPermission.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 32, "end_line": 45, "start_col": 0, "start_line": 44 }
(* Copyright 2020 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 PulseCore.FractionalPermission open FStar.Real /// This module defines fractional permissions, to be used with Steel references /// A fractional permission is a real value between 0 (excluded) and 1. /// 1 represents full ownership, while any fraction corresponds to a shared /// permission. /// Note: Does not use real literals, but rather the wrappers one, zero, two, … /// Real literals are currently not supported by Meta-F*'s reflection framework [@@erasable] noeq type perm : Type0 = | MkPerm: v:real{ v >. zero } -> perm /// A reference is only safely writeable if we have full permission let writeable (p: perm) : GTot bool = MkPerm?.v p = one /// Helper around splitting a permission in half let half_perm (p: perm) : Tot perm = MkPerm ((MkPerm?.v p) /. two) /// Helper to combine two permissions into one let sum_perm (p1 p2: perm) : Tot perm = MkPerm (MkPerm?.v p1 +. MkPerm?.v p2)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Real.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "PulseCore.FractionalPermission.fst" }
[ { "abbrev": false, "full_module": "FStar.Real", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p1: PulseCore.FractionalPermission.perm -> p2: PulseCore.FractionalPermission.perm -> Prims.GTot Prims.bool
Prims.GTot
[ "sometrivial" ]
[]
[ "PulseCore.FractionalPermission.perm", "FStar.Real.op_Less_Equals_Dot", "PulseCore.FractionalPermission.__proj__MkPerm__item__v", "Prims.bool" ]
[]
false
false
false
false
false
let lesser_equal_perm (p1 p2: perm) : GTot bool =
MkPerm?.v p1 <=. MkPerm?.v p2
false
Pulse.Soundness.Rewrite.fst
Pulse.Soundness.Rewrite.rewrite_soundness
val rewrite_soundness (#g:stt_env) (#t:st_term) (#c:comp) (d:st_typing g t c{T_Rewrite? d}) : GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))
val rewrite_soundness (#g:stt_env) (#t:st_term) (#c:comp) (d:st_typing g t c{T_Rewrite? d}) : GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))
let rewrite_soundness (#g:stt_env) (#t:st_term) (#c:comp) (d:st_typing g t c{T_Rewrite? d}) : GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) = let T_Rewrite _ p q p_typing equiv_p_q = d in let rp = elab_term p in let rq = elab_term q in let rp_typing : RT.tot_typing _ rp vprop_tm = tot_typing_soundness p_typing in let rq_typing : RT.tot_typing _ rq vprop_tm = tot_typing_soundness (let f, _ = vprop_equiv_typing equiv_p_q in f p_typing) in let d_stt_vprop_equiv = Pulse.Soundness.VPropEquiv.vprop_equiv_unit_soundness p_typing equiv_p_q in WT.rewrite_typing rp_typing rq_typing d_stt_vprop_equiv
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Rewrite.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 57, "end_line": 52, "start_col": 0, "start_line": 31 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Pulse.Soundness.Rewrite open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Typing.Combinators open Pulse.Elaborate.Pure open Pulse.Elaborate.Core open Pulse.Soundness.Common open Pulse.Checker.VPropEquiv module RT = FStar.Reflection.Typing module WT = Pulse.Steel.Wrapper.Typing
{ "checked_file": "/", "dependencies": [ "Pulse.Typing.Combinators.fsti.checked", "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Steel.Wrapper.Typing.fsti.checked", "Pulse.Soundness.VPropEquiv.fsti.checked", "Pulse.Soundness.Common.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.Pure.fst.checked", "Pulse.Elaborate.Core.fst.checked", "Pulse.Checker.VPropEquiv.fsti.checked", "prims.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Soundness.Rewrite.fst" }
[ { "abbrev": true, "full_module": "Pulse.Steel.Wrapper.Typing", "short_module": "WT" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker.VPropEquiv", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness.Common", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate.Core", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate.Pure", "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.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Soundness.Common", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate.Core", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate.Pure", "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": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
d: Pulse.Typing.st_typing g t c {T_Rewrite? d} -> Prims.GTot (FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g) (Pulse.Elaborate.Core.elab_st_typing d) (Pulse.Elaborate.Pure.elab_comp c))
Prims.GTot
[ "sometrivial" ]
[]
[ "Pulse.Soundness.Common.stt_env", "Pulse.Syntax.Base.st_term", "Pulse.Syntax.Base.comp", "Pulse.Typing.st_typing", "Prims.b2t", "Pulse.Typing.uu___is_T_Rewrite", "Pulse.Typing.Env.env", "Pulse.Syntax.Base.vprop", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.tm_vprop", "Pulse.Typing.vprop_equiv", "Pulse.Steel.Wrapper.Typing.rewrite_typing", "Pulse.Typing.elab_env", "FStar.Reflection.Typing.tot_typing", "Pulse.Reflection.Util.stt_vprop_equiv", "Pulse.Elaborate.Pure.elab_term", "Pulse.Soundness.VPropEquiv.vprop_equiv_unit_soundness", "Pulse.Reflection.Util.vprop_tm", "Pulse.Soundness.Common.tot_typing_soundness", "FStar.Pervasives.Native.tuple2", "Pulse.Typing.Combinators.vprop_equiv_typing", "FStar.Stubs.Reflection.Types.term", "Pulse.Elaborate.Core.elab_st_typing", "Pulse.Elaborate.Pure.elab_comp" ]
[]
false
false
false
false
false
let rewrite_soundness (#g: stt_env) (#t: st_term) (#c: comp) (d: st_typing g t c {T_Rewrite? d}) : GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_Rewrite _ p q p_typing equiv_p_q = d in let rp = elab_term p in let rq = elab_term q in let rp_typing:RT.tot_typing _ rp vprop_tm = tot_typing_soundness p_typing in let rq_typing:RT.tot_typing _ rq vprop_tm = tot_typing_soundness (let f, _ = vprop_equiv_typing equiv_p_q in f p_typing) in let d_stt_vprop_equiv = Pulse.Soundness.VPropEquiv.vprop_equiv_unit_soundness p_typing equiv_p_q in WT.rewrite_typing rp_typing rq_typing d_stt_vprop_equiv
false
PulseCore.FractionalPermission.fst
PulseCore.FractionalPermission.sum_perm
val sum_perm (p1 p2: perm) : Tot perm
val sum_perm (p1 p2: perm) : Tot perm
let sum_perm (p1 p2: perm) : Tot perm = MkPerm (MkPerm?.v p1 +. MkPerm?.v p2)
{ "file_name": "lib/pulse_core/PulseCore.FractionalPermission.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 40, "end_line": 41, "start_col": 0, "start_line": 40 }
(* Copyright 2020 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 PulseCore.FractionalPermission open FStar.Real /// This module defines fractional permissions, to be used with Steel references /// A fractional permission is a real value between 0 (excluded) and 1. /// 1 represents full ownership, while any fraction corresponds to a shared /// permission. /// Note: Does not use real literals, but rather the wrappers one, zero, two, … /// Real literals are currently not supported by Meta-F*'s reflection framework [@@erasable] noeq type perm : Type0 = | MkPerm: v:real{ v >. zero } -> perm /// A reference is only safely writeable if we have full permission let writeable (p: perm) : GTot bool = MkPerm?.v p = one /// Helper around splitting a permission in half let half_perm (p: perm) : Tot perm = MkPerm ((MkPerm?.v p) /. two)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Real.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "PulseCore.FractionalPermission.fst" }
[ { "abbrev": false, "full_module": "FStar.Real", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p1: PulseCore.FractionalPermission.perm -> p2: PulseCore.FractionalPermission.perm -> PulseCore.FractionalPermission.perm
Prims.Tot
[ "total" ]
[]
[ "PulseCore.FractionalPermission.perm", "PulseCore.FractionalPermission.MkPerm", "FStar.Real.op_Plus_Dot", "PulseCore.FractionalPermission.__proj__MkPerm__item__v" ]
[]
false
false
false
true
false
let sum_perm (p1 p2: perm) : Tot perm =
MkPerm (MkPerm?.v p1 +. MkPerm?.v p2)
false
PulseCore.FractionalPermission.fst
PulseCore.FractionalPermission.half_perm
val half_perm (p: perm) : Tot perm
val half_perm (p: perm) : Tot perm
let half_perm (p: perm) : Tot perm = MkPerm ((MkPerm?.v p) /. two)
{ "file_name": "lib/pulse_core/PulseCore.FractionalPermission.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 31, "end_line": 37, "start_col": 0, "start_line": 36 }
(* Copyright 2020 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 PulseCore.FractionalPermission open FStar.Real /// This module defines fractional permissions, to be used with Steel references /// A fractional permission is a real value between 0 (excluded) and 1. /// 1 represents full ownership, while any fraction corresponds to a shared /// permission. /// Note: Does not use real literals, but rather the wrappers one, zero, two, … /// Real literals are currently not supported by Meta-F*'s reflection framework [@@erasable] noeq type perm : Type0 = | MkPerm: v:real{ v >. zero } -> perm /// A reference is only safely writeable if we have full permission let writeable (p: perm) : GTot bool = MkPerm?.v p = one
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Real.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "PulseCore.FractionalPermission.fst" }
[ { "abbrev": false, "full_module": "FStar.Real", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: PulseCore.FractionalPermission.perm -> PulseCore.FractionalPermission.perm
Prims.Tot
[ "total" ]
[]
[ "PulseCore.FractionalPermission.perm", "PulseCore.FractionalPermission.MkPerm", "FStar.Real.op_Slash_Dot", "PulseCore.FractionalPermission.__proj__MkPerm__item__v", "FStar.Real.two" ]
[]
false
false
false
true
false
let half_perm (p: perm) : Tot perm =
MkPerm ((MkPerm?.v p) /. two)
false
PulseCore.FractionalPermission.fst
PulseCore.FractionalPermission.comp_perm
val comp_perm (p: perm{p `lesser_perm` full_perm}) : GTot perm
val comp_perm (p: perm{p `lesser_perm` full_perm}) : GTot perm
let comp_perm (p:perm{p `lesser_perm` full_perm}) : GTot perm = MkPerm (1.0R -. MkPerm?.v p)
{ "file_name": "lib/pulse_core/PulseCore.FractionalPermission.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 30, "end_line": 55, "start_col": 0, "start_line": 54 }
(* Copyright 2020 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 PulseCore.FractionalPermission open FStar.Real /// This module defines fractional permissions, to be used with Steel references /// A fractional permission is a real value between 0 (excluded) and 1. /// 1 represents full ownership, while any fraction corresponds to a shared /// permission. /// Note: Does not use real literals, but rather the wrappers one, zero, two, … /// Real literals are currently not supported by Meta-F*'s reflection framework [@@erasable] noeq type perm : Type0 = | MkPerm: v:real{ v >. zero } -> perm /// A reference is only safely writeable if we have full permission let writeable (p: perm) : GTot bool = MkPerm?.v p = one /// Helper around splitting a permission in half let half_perm (p: perm) : Tot perm = MkPerm ((MkPerm?.v p) /. two) /// Helper to combine two permissions into one let sum_perm (p1 p2: perm) : Tot perm = MkPerm (MkPerm?.v p1 +. MkPerm?.v p2) /// Helper to compare two permissions let lesser_equal_perm (p1 p2:perm) : GTot bool = MkPerm?.v p1 <=. MkPerm?.v p2 let lesser_perm (p1 p2:perm) : GTot bool = MkPerm?.v p1 <. MkPerm?.v p2 /// Wrapper around the full permission value let full_perm : perm = MkPerm one
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Real.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "PulseCore.FractionalPermission.fst" }
[ { "abbrev": false, "full_module": "FStar.Real", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: PulseCore.FractionalPermission.perm {PulseCore.FractionalPermission.lesser_perm p PulseCore.FractionalPermission.full_perm} -> Prims.GTot PulseCore.FractionalPermission.perm
Prims.GTot
[ "sometrivial" ]
[]
[ "PulseCore.FractionalPermission.perm", "Prims.b2t", "PulseCore.FractionalPermission.lesser_perm", "PulseCore.FractionalPermission.full_perm", "PulseCore.FractionalPermission.MkPerm", "FStar.Real.op_Subtraction_Dot", "PulseCore.FractionalPermission.__proj__MkPerm__item__v" ]
[]
false
false
false
false
false
let comp_perm (p: perm{p `lesser_perm` full_perm}) : GTot perm =
MkPerm (1.0R -. MkPerm?.v p)
false
PulseCore.FractionalPermission.fst
PulseCore.FractionalPermission.full_perm
val full_perm:perm
val full_perm:perm
let full_perm : perm = MkPerm one
{ "file_name": "lib/pulse_core/PulseCore.FractionalPermission.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 33, "end_line": 51, "start_col": 0, "start_line": 51 }
(* Copyright 2020 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 PulseCore.FractionalPermission open FStar.Real /// This module defines fractional permissions, to be used with Steel references /// A fractional permission is a real value between 0 (excluded) and 1. /// 1 represents full ownership, while any fraction corresponds to a shared /// permission. /// Note: Does not use real literals, but rather the wrappers one, zero, two, … /// Real literals are currently not supported by Meta-F*'s reflection framework [@@erasable] noeq type perm : Type0 = | MkPerm: v:real{ v >. zero } -> perm /// A reference is only safely writeable if we have full permission let writeable (p: perm) : GTot bool = MkPerm?.v p = one /// Helper around splitting a permission in half let half_perm (p: perm) : Tot perm = MkPerm ((MkPerm?.v p) /. two) /// Helper to combine two permissions into one let sum_perm (p1 p2: perm) : Tot perm = MkPerm (MkPerm?.v p1 +. MkPerm?.v p2) /// Helper to compare two permissions let lesser_equal_perm (p1 p2:perm) : GTot bool = MkPerm?.v p1 <=. MkPerm?.v p2 let lesser_perm (p1 p2:perm) : GTot bool = MkPerm?.v p1 <. MkPerm?.v p2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Real.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "PulseCore.FractionalPermission.fst" }
[ { "abbrev": false, "full_module": "FStar.Real", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
PulseCore.FractionalPermission.perm
Prims.Tot
[ "total" ]
[]
[ "PulseCore.FractionalPermission.MkPerm", "FStar.Real.one" ]
[]
false
false
false
true
false
let full_perm:perm =
MkPerm one
false
PulseCore.FractionalPermission.fst
PulseCore.FractionalPermission.sum_halves
val sum_halves (p: perm) : Lemma (sum_perm (half_perm p) (half_perm p) == p) [SMTPat (sum_perm (half_perm p) (half_perm p))]
val sum_halves (p: perm) : Lemma (sum_perm (half_perm p) (half_perm p) == p) [SMTPat (sum_perm (half_perm p) (half_perm p))]
let sum_halves (p:perm) : Lemma (sum_perm (half_perm p) (half_perm p) == p) [SMTPat (sum_perm (half_perm p) (half_perm p))] = assert (forall (r:real). r /. 2.0R +. r /. 2.0R == r)
{ "file_name": "lib/pulse_core/PulseCore.FractionalPermission.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 57, "end_line": 61, "start_col": 0, "start_line": 58 }
(* Copyright 2020 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 PulseCore.FractionalPermission open FStar.Real /// This module defines fractional permissions, to be used with Steel references /// A fractional permission is a real value between 0 (excluded) and 1. /// 1 represents full ownership, while any fraction corresponds to a shared /// permission. /// Note: Does not use real literals, but rather the wrappers one, zero, two, … /// Real literals are currently not supported by Meta-F*'s reflection framework [@@erasable] noeq type perm : Type0 = | MkPerm: v:real{ v >. zero } -> perm /// A reference is only safely writeable if we have full permission let writeable (p: perm) : GTot bool = MkPerm?.v p = one /// Helper around splitting a permission in half let half_perm (p: perm) : Tot perm = MkPerm ((MkPerm?.v p) /. two) /// Helper to combine two permissions into one let sum_perm (p1 p2: perm) : Tot perm = MkPerm (MkPerm?.v p1 +. MkPerm?.v p2) /// Helper to compare two permissions let lesser_equal_perm (p1 p2:perm) : GTot bool = MkPerm?.v p1 <=. MkPerm?.v p2 let lesser_perm (p1 p2:perm) : GTot bool = MkPerm?.v p1 <. MkPerm?.v p2 /// Wrapper around the full permission value let full_perm : perm = MkPerm one /// Complement of a permission let comp_perm (p:perm{p `lesser_perm` full_perm}) : GTot perm = MkPerm (1.0R -. MkPerm?.v p)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Real.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "PulseCore.FractionalPermission.fst" }
[ { "abbrev": false, "full_module": "FStar.Real", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "PulseCore", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: PulseCore.FractionalPermission.perm -> FStar.Pervasives.Lemma (ensures PulseCore.FractionalPermission.sum_perm (PulseCore.FractionalPermission.half_perm p) (PulseCore.FractionalPermission.half_perm p) == p) [ SMTPat (PulseCore.FractionalPermission.sum_perm (PulseCore.FractionalPermission.half_perm p) (PulseCore.FractionalPermission.half_perm p)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "PulseCore.FractionalPermission.perm", "Prims._assert", "Prims.l_Forall", "FStar.Real.real", "Prims.eq2", "FStar.Real.op_Plus_Dot", "FStar.Real.op_Slash_Dot", "Prims.unit", "Prims.l_True", "Prims.squash", "PulseCore.FractionalPermission.sum_perm", "PulseCore.FractionalPermission.half_perm", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
false
false
true
false
false
let sum_halves (p: perm) : Lemma (sum_perm (half_perm p) (half_perm p) == p) [SMTPat (sum_perm (half_perm p) (half_perm p))] =
assert (forall (r: real). r /. 2.0R +. r /. 2.0R == r)
false
Hacl.Impl.Store56.fst
Hacl.Impl.Store56.lemma_store_56_bytes
val lemma_store_56_bytes (k: lbytes 32) (b0 b1 b2 b3 b4: uint64) : Lemma (requires v b0 == nat_from_bytes_le (Seq.slice k 0 7) /\ v b1 == nat_from_bytes_le (Seq.slice k 7 14) /\ v b2 == nat_from_bytes_le (Seq.slice k 14 21) /\ v b3 == nat_from_bytes_le (Seq.slice k 21 28) /\ v b4 == nat_from_bytes_le (Seq.slice k 28 32)) (ensures S56.as_nat5 (b0, b1, b2, b3, b4) == nat_from_bytes_le k)
val lemma_store_56_bytes (k: lbytes 32) (b0 b1 b2 b3 b4: uint64) : Lemma (requires v b0 == nat_from_bytes_le (Seq.slice k 0 7) /\ v b1 == nat_from_bytes_le (Seq.slice k 7 14) /\ v b2 == nat_from_bytes_le (Seq.slice k 14 21) /\ v b3 == nat_from_bytes_le (Seq.slice k 21 28) /\ v b4 == nat_from_bytes_le (Seq.slice k 28 32)) (ensures S56.as_nat5 (b0, b1, b2, b3, b4) == nat_from_bytes_le k)
let lemma_store_56_bytes (k:lbytes 32) (b0 b1 b2 b3 b4:uint64) : Lemma (requires v b0 == nat_from_bytes_le (Seq.slice k 0 7) /\ v b1 == nat_from_bytes_le (Seq.slice k 7 14) /\ v b2 == nat_from_bytes_le (Seq.slice k 14 21) /\ v b3 == nat_from_bytes_le (Seq.slice k 21 28) /\ v b4 == nat_from_bytes_le (Seq.slice k 28 32)) (ensures S56.as_nat5 (b0, b1, b2, b3, b4) == nat_from_bytes_le k) = lemma_nat_from_bytes_le_append (Seq.slice k 0 7) (Seq.slice k 7 14); lemma_nat_from_bytes_le_append (Seq.slice k 0 14) (Seq.slice k 14 21); lemma_nat_from_bytes_le_append (Seq.slice k 0 21) (Seq.slice k 21 28); lemma_nat_from_bytes_le_append (Seq.slice k 0 28) (Seq.slice k 28 32); assert (Seq.append (Seq.slice k 0 7) (Seq.slice k 7 14) `Seq.equal` Seq.slice k 0 14); assert (Seq.append (Seq.slice k 0 14) (Seq.slice k 14 21) `Seq.equal` Seq.slice k 0 21); assert (Seq.append (Seq.slice k 0 21) (Seq.slice k 21 28) `Seq.equal` Seq.slice k 0 28); assert (Seq.append (Seq.slice k 0 28) (Seq.slice k 28 32) `Seq.equal` k); assert_norm (pow2 56 == 0x100000000000000); assert_norm (pow2 112 == 0x10000000000000000000000000000); assert_norm (pow2 168 == 0x1000000000000000000000000000000000000000000); assert_norm (pow2 224 == 0x100000000000000000000000000000000000000000000000000000000)
{ "file_name": "code/ed25519/Hacl.Impl.Store56.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 87, "end_line": 90, "start_col": 0, "start_line": 70 }
module Hacl.Impl.Store56 module ST = FStar.HyperStack.ST open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.ByteSequence open Lib.Buffer open Lib.ByteBuffer module F56 = Hacl.Impl.BignumQ.Mul module S56 = Hacl.Spec.BignumQ.Definitions #reset-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val hstore56_le: out:lbuffer uint8 32ul -> off:size_t{v off <= 21} -> x:uint64{v x < pow2 56} -> Stack unit (requires fun h -> live h out) (ensures fun h0 _ h1 -> modifies (loc (gsub out off 8ul)) h0 h1 /\ nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)) == v x ) let hstore56_le out off x = let b8 = sub out off 8ul in lemma_uint_to_bytes_le_preserves_value x; uint_to_bytes_le b8 x; let h1 = ST.get() in calc (==) { v x <: nat; (==) { Math.Lemmas.small_mod (v x) (pow2 56) } (v x) % pow2 56 <: nat; (==) { assert (Seq.equal (as_seq h1 b8) (Seq.slice (as_seq h1 out) (v off) (v off + 8))) } (nat_from_bytes_le (as_seq h1 b8)) % pow2 56; (==) { nat_from_intseq_le_slice_lemma (as_seq h1 b8) 7 } (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) + pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) % pow2 56; (==) { Math.Lemmas.lemma_mod_plus_distr_r (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.swap_mul (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.cancel_mul_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56) } nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) % pow2 56; (==) { Math.Lemmas.small_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56); assert (Seq.equal (Seq.slice (as_seq h1 b8) 0 7) (Seq.slice (as_seq h1 out) (v off) (v off + 7))) } nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)); } let lemma_nat_from_bytes_le_append (k1 k2:bytes) : Lemma (requires Seq.length k1 + Seq.length k2 <= max_size_t) (ensures nat_from_bytes_le (Seq.append k1 k2) == nat_from_bytes_le k1 + pow2 (Seq.length k1 * 8) * nat_from_bytes_le k2) = let k = Seq.append k1 k2 in let n = Seq.length k1 + Seq.length k2 in nat_from_intseq_le_slice_lemma #U8 #SEC #n k (Seq.length k1); assert (k1 `Seq.equal` Seq.slice k 0 (Seq.length k1)); assert (k2 `Seq.equal` Seq.slice k (Seq.length k1) n)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.BignumQ.Definitions.fst.checked", "Hacl.Impl.BignumQ.Mul.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Store56.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.BignumQ.Definitions", "short_module": "S56" }, { "abbrev": true, "full_module": "Hacl.Impl.BignumQ.Mul", "short_module": "F56" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "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": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Lib.ByteSequence.lbytes 32 -> b0: Lib.IntTypes.uint64 -> b1: Lib.IntTypes.uint64 -> b2: Lib.IntTypes.uint64 -> b3: Lib.IntTypes.uint64 -> b4: Lib.IntTypes.uint64 -> FStar.Pervasives.Lemma (requires Lib.IntTypes.v b0 == Lib.ByteSequence.nat_from_bytes_le (FStar.Seq.Base.slice k 0 7) /\ Lib.IntTypes.v b1 == Lib.ByteSequence.nat_from_bytes_le (FStar.Seq.Base.slice k 7 14) /\ Lib.IntTypes.v b2 == Lib.ByteSequence.nat_from_bytes_le (FStar.Seq.Base.slice k 14 21) /\ Lib.IntTypes.v b3 == Lib.ByteSequence.nat_from_bytes_le (FStar.Seq.Base.slice k 21 28) /\ Lib.IntTypes.v b4 == Lib.ByteSequence.nat_from_bytes_le (FStar.Seq.Base.slice k 28 32)) (ensures Hacl.Spec.BignumQ.Definitions.as_nat5 (b0, b1, b2, b3, b4) == Lib.ByteSequence.nat_from_bytes_le k)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Lib.ByteSequence.lbytes", "Lib.IntTypes.uint64", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "Prims.pow2", "Prims.unit", "Prims._assert", "FStar.Seq.Base.equal", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "FStar.Seq.Base.append", "FStar.Seq.Base.slice", "Hacl.Impl.Store56.lemma_nat_from_bytes_le_append", "Prims.l_and", "Prims.l_or", "Lib.IntTypes.range", "Lib.IntTypes.U64", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "Prims.op_LessThan", "FStar.Mul.op_Star", "Lib.Sequence.length", "Lib.IntTypes.v", "Lib.ByteSequence.nat_from_bytes_le", "Prims.squash", "Prims.nat", "Hacl.Spec.BignumQ.Definitions.as_nat5", "FStar.Pervasives.Native.Mktuple5", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_store_56_bytes (k: lbytes 32) (b0 b1 b2 b3 b4: uint64) : Lemma (requires v b0 == nat_from_bytes_le (Seq.slice k 0 7) /\ v b1 == nat_from_bytes_le (Seq.slice k 7 14) /\ v b2 == nat_from_bytes_le (Seq.slice k 14 21) /\ v b3 == nat_from_bytes_le (Seq.slice k 21 28) /\ v b4 == nat_from_bytes_le (Seq.slice k 28 32)) (ensures S56.as_nat5 (b0, b1, b2, b3, b4) == nat_from_bytes_le k) =
lemma_nat_from_bytes_le_append (Seq.slice k 0 7) (Seq.slice k 7 14); lemma_nat_from_bytes_le_append (Seq.slice k 0 14) (Seq.slice k 14 21); lemma_nat_from_bytes_le_append (Seq.slice k 0 21) (Seq.slice k 21 28); lemma_nat_from_bytes_le_append (Seq.slice k 0 28) (Seq.slice k 28 32); assert ((Seq.append (Seq.slice k 0 7) (Seq.slice k 7 14)) `Seq.equal` (Seq.slice k 0 14)); assert ((Seq.append (Seq.slice k 0 14) (Seq.slice k 14 21)) `Seq.equal` (Seq.slice k 0 21)); assert ((Seq.append (Seq.slice k 0 21) (Seq.slice k 21 28)) `Seq.equal` (Seq.slice k 0 28)); assert ((Seq.append (Seq.slice k 0 28) (Seq.slice k 28 32)) `Seq.equal` k); assert_norm (pow2 56 == 0x100000000000000); assert_norm (pow2 112 == 0x10000000000000000000000000000); assert_norm (pow2 168 == 0x1000000000000000000000000000000000000000000); assert_norm (pow2 224 == 0x100000000000000000000000000000000000000000000000000000000)
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_qcode_Fmul
val va_qcode_Fmul (va_mods: va_mods_t) (tmp_b inA_b dst_b inB_b: buffer64) : (va_quickCode unit (va_code_Fmul ()))
val va_qcode_Fmul (va_mods: va_mods_t) (tmp_b inA_b dst_b inB_b: buffer64) : (va_quickCode unit (va_code_Fmul ()))
let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 61, "end_line": 87, "start_col": 0, "start_line": 55 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_mods: Vale.X64.QuickCode.va_mods_t -> tmp_b: Vale.X64.Memory.buffer64 -> inA_b: Vale.X64.Memory.buffer64 -> dst_b: Vale.X64.Memory.buffer64 -> inB_b: Vale.X64.Memory.buffer64 -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Curve25519.X64.FastWide.va_code_Fmul ())
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.QuickCode.va_mods_t", "Vale.X64.Memory.buffer64", "Vale.X64.QuickCodes.qblock", "Prims.unit", "Prims.Cons", "Vale.X64.Decls.va_code", "Vale.X64.InsMem.va_code_CreateHeaplets", "Vale.X64.InsBasic.va_code_LargeComment", "Vale.Curve25519.X64.FastMul.va_code_Fast_multiply", "Vale.X64.InsBasic.va_code_Newline", "Vale.X64.InsBasic.va_code_Comment", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRsi", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rR15", "Vale.Curve25519.X64.FastHybrid.va_code_Carry_wide", "Vale.X64.InsMem.va_code_DestroyHeaplets", "Prims.Nil", "Vale.X64.Machine_s.precode", "Vale.X64.Decls.ins", "Vale.X64.Decls.ocmp", "Vale.X64.Decls.va_state", "Vale.X64.QuickCodes.va_QSeq", "Vale.X64.QuickCodes.va_range1", "Vale.X64.InsMem.va_quick_CreateHeaplets", "Vale.Arch.HeapImpl.buffer_info", "Vale.X64.InsMem.declare_buffer64", "Vale.Arch.HeapTypes_s.Secret", "Vale.Arch.HeapImpl.Immutable", "Vale.Arch.HeapImpl.Mutable", "Vale.X64.InsBasic.va_quick_LargeComment", "Vale.Curve25519.X64.FastMul.va_quick_Fast_multiply", "Vale.X64.InsBasic.va_quick_Newline", "Vale.X64.InsBasic.va_quick_Comment", "Vale.X64.InsBasic.va_quick_Mov64", "Vale.Curve25519.X64.FastHybrid.va_quick_Carry_wide", "Vale.X64.InsMem.va_quick_DestroyHeaplets", "Vale.X64.QuickCodes.va_QEmpty", "Vale.Def.Words_s.nat64", "Vale.X64.Decls.va_get_reg64", "Vale.X64.Machine_s.rRcx", "Vale.X64.State.vale_state", "Vale.X64.QuickCodes.quickCodes", "Vale.X64.QuickCode.va_quickCode", "Vale.Curve25519.X64.FastWide.va_code_Fmul" ]
[]
false
false
false
false
false
let va_qcode_Fmul (va_mods: va_mods_t) (tmp_b inA_b dst_b inB_b: buffer64) : (va_quickCode unit (va_code_Fmul ())) =
(qblock va_mods (fun (va_s: va_state) -> let va_old_s:va_state = va_s in let tmp_in:nat64 = va_get_reg64 rRdi va_s in let inA_in:nat64 = va_get_reg64 rRsi va_s in let dst_in:nat64 = va_get_reg64 rR15 va_s in let inB_in:nat64 = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([ declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable ])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2") (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers") (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field") (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_codegen_success_Fmul
val va_codegen_success_Fmul : va_dummy:unit -> Tot va_pbool
val va_codegen_success_Fmul : va_dummy:unit -> Tot va_pbool
let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 67, "end_line": 52, "start_col": 0, "start_line": 40 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.X64.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.X64.Decls.va_pbool_and", "Vale.X64.InsMem.va_codegen_success_CreateHeaplets", "Vale.X64.InsBasic.va_codegen_success_LargeComment", "Vale.Curve25519.X64.FastMul.va_codegen_success_Fast_multiply", "Vale.X64.InsBasic.va_codegen_success_Newline", "Vale.X64.InsBasic.va_codegen_success_Comment", "Vale.X64.InsBasic.va_codegen_success_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRsi", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rR15", "Vale.Curve25519.X64.FastHybrid.va_codegen_success_Carry_wide", "Vale.X64.InsMem.va_codegen_success_DestroyHeaplets", "Vale.X64.Decls.va_ttrue", "Vale.X64.Decls.va_pbool" ]
[]
false
false
false
true
false
let va_codegen_success_Fmul () =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers") (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_code_Fmul2
val va_code_Fmul2 : va_dummy:unit -> Tot va_code
val va_code_Fmul2 : va_dummy:unit -> Tot va_code
let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 73, "end_line": 391, "start_col": 0, "start_line": 379 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.X64.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.X64.Decls.va_Block", "Vale.X64.Decls.va_CCons", "Vale.X64.InsMem.va_code_CreateHeaplets", "Vale.X64.InsBasic.va_code_LargeComment", "Vale.Curve25519.X64.FastMul.va_code_Fast_multiply", "Vale.X64.InsBasic.va_code_Newline", "Vale.X64.InsBasic.va_code_Comment", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRsi", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rR15", "Vale.Curve25519.X64.FastHybrid.va_code_Carry_wide", "Vale.X64.InsMem.va_code_DestroyHeaplets", "Vale.X64.Decls.va_CNil", "Vale.X64.Decls.va_code" ]
[]
false
false
false
true
false
let va_code_Fmul2 () =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]") (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers") (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_codegen_success_Fmul2
val va_codegen_success_Fmul2 : va_dummy:unit -> Tot va_pbool
val va_codegen_success_Fmul2 : va_dummy:unit -> Tot va_pbool
let va_codegen_success_Fmul2 () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 71, "end_line": 410, "start_col": 0, "start_line": 394 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2 [@ "opaque_to_smt" va_qattr] let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.X64.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.X64.Decls.va_pbool_and", "Vale.X64.InsMem.va_codegen_success_CreateHeaplets", "Vale.X64.InsBasic.va_codegen_success_LargeComment", "Vale.Curve25519.X64.FastMul.va_codegen_success_Fast_multiply", "Vale.X64.InsBasic.va_codegen_success_Newline", "Vale.X64.InsBasic.va_codegen_success_Comment", "Vale.X64.InsBasic.va_codegen_success_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRsi", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rR15", "Vale.Curve25519.X64.FastHybrid.va_codegen_success_Carry_wide", "Vale.X64.InsMem.va_codegen_success_DestroyHeaplets", "Vale.X64.Decls.va_ttrue", "Vale.X64.Decls.va_pbool" ]
[]
false
false
false
true
false
let va_codegen_success_Fmul2 () =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers") (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_code_Fmul
val va_code_Fmul : va_dummy:unit -> Tot va_code
val va_code_Fmul : va_dummy:unit -> Tot va_code
let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 18, "end_line": 37, "start_col": 0, "start_line": 27 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.X64.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.X64.Decls.va_Block", "Vale.X64.Decls.va_CCons", "Vale.X64.InsMem.va_code_CreateHeaplets", "Vale.X64.InsBasic.va_code_LargeComment", "Vale.Curve25519.X64.FastMul.va_code_Fast_multiply", "Vale.X64.InsBasic.va_code_Newline", "Vale.X64.InsBasic.va_code_Comment", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRsi", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rR15", "Vale.Curve25519.X64.FastHybrid.va_code_Carry_wide", "Vale.X64.InsMem.va_code_DestroyHeaplets", "Vale.X64.Decls.va_CNil", "Vale.X64.Decls.va_code" ]
[]
false
false
false
true
false
let va_code_Fmul () =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2") (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers") (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))) ))
false
Hacl.Impl.Store56.fst
Hacl.Impl.Store56.store_56
val store_56: out:lbuffer uint8 32ul -> b:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h out /\ live h b /\ (let s = as_seq h b in v (Seq.index s 0) < pow2 56 /\ v (Seq.index s 1) < pow2 56 /\ v (Seq.index s 2) < pow2 56 /\ v (Seq.index s 3) < pow2 56 /\ v (Seq.index s 4) < pow2 32) ) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ (assert_norm (pow2 56 < pow2 64); assert_norm (pow2 32 < pow2 64); assert_norm (S56.as_nat5 (u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 32 - 1)) < pow2 256); nat_to_bytes_le 32 (F56.as_nat h0 b) == as_seq h1 out) )
val store_56: out:lbuffer uint8 32ul -> b:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h out /\ live h b /\ (let s = as_seq h b in v (Seq.index s 0) < pow2 56 /\ v (Seq.index s 1) < pow2 56 /\ v (Seq.index s 2) < pow2 56 /\ v (Seq.index s 3) < pow2 56 /\ v (Seq.index s 4) < pow2 32) ) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ (assert_norm (pow2 56 < pow2 64); assert_norm (pow2 32 < pow2 64); assert_norm (S56.as_nat5 (u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 32 - 1)) < pow2 256); nat_to_bytes_le 32 (F56.as_nat h0 b) == as_seq h1 out) )
let store_56 out b = let b0 = b.(0ul) in let b1 = b.(1ul) in let b2 = b.(2ul) in let b3 = b.(3ul) in let b4 = b.(4ul) in let b4' = to_u32 b4 in hstore56_le out 0ul b0; hstore56_le out 7ul b1; hstore56_le out 14ul b2; hstore56_le out 21ul b3; uint_to_bytes_le (sub out 28ul 4ul) b4'; let h1 = ST.get() in assert (Seq.equal (Seq.slice (as_seq h1 out) 0 7) (as_seq h1 (gsub out 0ul 7ul))); assert (Seq.equal (Seq.slice (as_seq h1 out) 7 14) (as_seq h1 (gsub out 7ul 7ul))); assert (Seq.equal (Seq.slice (as_seq h1 out) 14 21) (as_seq h1 (gsub out 14ul 7ul))); assert (Seq.equal (Seq.slice (as_seq h1 out) 21 28) (as_seq h1 (gsub out 21ul 7ul))); assert (Seq.equal (Seq.slice (as_seq h1 out) 28 32) (as_seq h1 (gsub out 28ul 4ul))); lemma_uint_to_bytes_le_preserves_value b4'; lemma_store_56_bytes (as_seq h1 out) b0 b1 b2 b3 b4; lemma_nat_from_to_bytes_le_preserves_value (as_seq h1 out) 32
{ "file_name": "code/ed25519/Hacl.Impl.Store56.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 63, "end_line": 132, "start_col": 0, "start_line": 111 }
module Hacl.Impl.Store56 module ST = FStar.HyperStack.ST open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.ByteSequence open Lib.Buffer open Lib.ByteBuffer module F56 = Hacl.Impl.BignumQ.Mul module S56 = Hacl.Spec.BignumQ.Definitions #reset-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val hstore56_le: out:lbuffer uint8 32ul -> off:size_t{v off <= 21} -> x:uint64{v x < pow2 56} -> Stack unit (requires fun h -> live h out) (ensures fun h0 _ h1 -> modifies (loc (gsub out off 8ul)) h0 h1 /\ nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)) == v x ) let hstore56_le out off x = let b8 = sub out off 8ul in lemma_uint_to_bytes_le_preserves_value x; uint_to_bytes_le b8 x; let h1 = ST.get() in calc (==) { v x <: nat; (==) { Math.Lemmas.small_mod (v x) (pow2 56) } (v x) % pow2 56 <: nat; (==) { assert (Seq.equal (as_seq h1 b8) (Seq.slice (as_seq h1 out) (v off) (v off + 8))) } (nat_from_bytes_le (as_seq h1 b8)) % pow2 56; (==) { nat_from_intseq_le_slice_lemma (as_seq h1 b8) 7 } (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) + pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) % pow2 56; (==) { Math.Lemmas.lemma_mod_plus_distr_r (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56 * nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.swap_mul (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56); Math.Lemmas.cancel_mul_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 7 8)) (pow2 56) } nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7) % pow2 56; (==) { Math.Lemmas.small_mod (nat_from_bytes_le (Seq.slice (as_seq h1 b8) 0 7)) (pow2 56); assert (Seq.equal (Seq.slice (as_seq h1 b8) 0 7) (Seq.slice (as_seq h1 out) (v off) (v off + 7))) } nat_from_bytes_le (Seq.slice (as_seq h1 out) (v off) (v off + 7)); } let lemma_nat_from_bytes_le_append (k1 k2:bytes) : Lemma (requires Seq.length k1 + Seq.length k2 <= max_size_t) (ensures nat_from_bytes_le (Seq.append k1 k2) == nat_from_bytes_le k1 + pow2 (Seq.length k1 * 8) * nat_from_bytes_le k2) = let k = Seq.append k1 k2 in let n = Seq.length k1 + Seq.length k2 in nat_from_intseq_le_slice_lemma #U8 #SEC #n k (Seq.length k1); assert (k1 `Seq.equal` Seq.slice k 0 (Seq.length k1)); assert (k2 `Seq.equal` Seq.slice k (Seq.length k1) n) let lemma_store_56_bytes (k:lbytes 32) (b0 b1 b2 b3 b4:uint64) : Lemma (requires v b0 == nat_from_bytes_le (Seq.slice k 0 7) /\ v b1 == nat_from_bytes_le (Seq.slice k 7 14) /\ v b2 == nat_from_bytes_le (Seq.slice k 14 21) /\ v b3 == nat_from_bytes_le (Seq.slice k 21 28) /\ v b4 == nat_from_bytes_le (Seq.slice k 28 32)) (ensures S56.as_nat5 (b0, b1, b2, b3, b4) == nat_from_bytes_le k) = lemma_nat_from_bytes_le_append (Seq.slice k 0 7) (Seq.slice k 7 14); lemma_nat_from_bytes_le_append (Seq.slice k 0 14) (Seq.slice k 14 21); lemma_nat_from_bytes_le_append (Seq.slice k 0 21) (Seq.slice k 21 28); lemma_nat_from_bytes_le_append (Seq.slice k 0 28) (Seq.slice k 28 32); assert (Seq.append (Seq.slice k 0 7) (Seq.slice k 7 14) `Seq.equal` Seq.slice k 0 14); assert (Seq.append (Seq.slice k 0 14) (Seq.slice k 14 21) `Seq.equal` Seq.slice k 0 21); assert (Seq.append (Seq.slice k 0 21) (Seq.slice k 21 28) `Seq.equal` Seq.slice k 0 28); assert (Seq.append (Seq.slice k 0 28) (Seq.slice k 28 32) `Seq.equal` k); assert_norm (pow2 56 == 0x100000000000000); assert_norm (pow2 112 == 0x10000000000000000000000000000); assert_norm (pow2 168 == 0x1000000000000000000000000000000000000000000); assert_norm (pow2 224 == 0x100000000000000000000000000000000000000000000000000000000) val store_56: out:lbuffer uint8 32ul -> b:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h out /\ live h b /\ (let s = as_seq h b in v (Seq.index s 0) < pow2 56 /\ v (Seq.index s 1) < pow2 56 /\ v (Seq.index s 2) < pow2 56 /\ v (Seq.index s 3) < pow2 56 /\ v (Seq.index s 4) < pow2 32) ) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ (assert_norm (pow2 56 < pow2 64); assert_norm (pow2 32 < pow2 64); assert_norm (S56.as_nat5 (u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 32 - 1)) < pow2 256); nat_to_bytes_le 32 (F56.as_nat h0 b) == as_seq h1 out) )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.BignumQ.Definitions.fst.checked", "Hacl.Impl.BignumQ.Mul.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Store56.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.BignumQ.Definitions", "short_module": "S56" }, { "abbrev": true, "full_module": "Hacl.Impl.BignumQ.Mul", "short_module": "F56" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "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": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> b: Lib.Buffer.lbuffer Lib.IntTypes.uint64 5ul -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.uint64", "Lib.ByteSequence.lemma_nat_from_to_bytes_le_preserves_value", "Lib.IntTypes.SEC", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Prims.unit", "Hacl.Impl.Store56.lemma_store_56_bytes", "Lib.ByteSequence.lemma_uint_to_bytes_le_preserves_value", "Lib.IntTypes.U32", "Prims._assert", "FStar.Seq.Base.equal", "FStar.Seq.Base.slice", "Lib.Buffer.gsub", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Lib.ByteBuffer.uint_to_bytes_le", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.mk_int", "Lib.IntTypes.PUB", "Lib.Buffer.sub", "Hacl.Impl.Store56.hstore56_le", "Lib.IntTypes.to_u32", "Lib.IntTypes.U64", "Lib.Buffer.op_Array_Access" ]
[]
false
true
false
false
false
let store_56 out b =
let b0 = b.(0ul) in let b1 = b.(1ul) in let b2 = b.(2ul) in let b3 = b.(3ul) in let b4 = b.(4ul) in let b4' = to_u32 b4 in hstore56_le out 0ul b0; hstore56_le out 7ul b1; hstore56_le out 14ul b2; hstore56_le out 21ul b3; uint_to_bytes_le (sub out 28ul 4ul) b4'; let h1 = ST.get () in assert (Seq.equal (Seq.slice (as_seq h1 out) 0 7) (as_seq h1 (gsub out 0ul 7ul))); assert (Seq.equal (Seq.slice (as_seq h1 out) 7 14) (as_seq h1 (gsub out 7ul 7ul))); assert (Seq.equal (Seq.slice (as_seq h1 out) 14 21) (as_seq h1 (gsub out 14ul 7ul))); assert (Seq.equal (Seq.slice (as_seq h1 out) 21 28) (as_seq h1 (gsub out 21ul 7ul))); assert (Seq.equal (Seq.slice (as_seq h1 out) 28 32) (as_seq h1 (gsub out 28ul 4ul))); lemma_uint_to_bytes_le_preserves_value b4'; lemma_store_56_bytes (as_seq h1 out) b0 b1 b2 b3 b4; lemma_nat_from_to_bytes_le_preserves_value (as_seq h1 out) 32
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_code_Fmul_stdcall
val va_code_Fmul_stdcall : win:bool -> Tot va_code
val va_code_Fmul_stdcall : win:bool -> Tot va_code
let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ())))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 58, "end_line": 184, "start_col": 0, "start_line": 168 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
win: Prims.bool -> Vale.X64.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Prims.bool", "Vale.X64.Decls.va_Block", "Vale.X64.Decls.va_CCons", "Vale.X64.InsStack.va_code_Push_Secret", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR15", "Vale.X64.Machine_s.rRbx", "Vale.X64.Machine_s.rRsi", "Vale.X64.Machine_s.rRdi", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRdx", "Vale.X64.Machine_s.rR8", "Vale.X64.Machine_s.rR9", "Vale.X64.Decls.va_CNil", "Vale.X64.Decls.va_code", "Vale.Curve25519.X64.FastWide.va_code_Fmul", "Vale.X64.InsStack.va_code_Pop_Secret" ]
[]
false
false
false
true
false
let va_code_Fmul_stdcall win =
(va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx ) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi )) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi) ) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13 )) (va_CNil ())))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_qcode_Fmul2
val va_qcode_Fmul2 (va_mods: va_mods_t) (tmp_b inA_b dst_b inB_b: buffer64) : (va_quickCode unit (va_code_Fmul2 ()))
val va_qcode_Fmul2 (va_mods: va_mods_t) (tmp_b inA_b dst_b inB_b: buffer64) : (va_quickCode unit (va_code_Fmul2 ()))
let va_qcode_Fmul2 (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 334 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 340 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 4 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 344 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the results back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 349 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 350 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 351 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 4 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 353 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 65, "end_line": 455, "start_col": 0, "start_line": 413 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2 [@ "opaque_to_smt" va_qattr] let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2 () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_mods: Vale.X64.QuickCode.va_mods_t -> tmp_b: Vale.X64.Memory.buffer64 -> inA_b: Vale.X64.Memory.buffer64 -> dst_b: Vale.X64.Memory.buffer64 -> inB_b: Vale.X64.Memory.buffer64 -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Curve25519.X64.FastWide.va_code_Fmul2 ())
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.QuickCode.va_mods_t", "Vale.X64.Memory.buffer64", "Vale.X64.QuickCodes.qblock", "Prims.unit", "Prims.Cons", "Vale.X64.Decls.va_code", "Vale.X64.InsMem.va_code_CreateHeaplets", "Vale.X64.InsBasic.va_code_LargeComment", "Vale.Curve25519.X64.FastMul.va_code_Fast_multiply", "Vale.X64.InsBasic.va_code_Newline", "Vale.X64.InsBasic.va_code_Comment", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRsi", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rR15", "Vale.Curve25519.X64.FastHybrid.va_code_Carry_wide", "Vale.X64.InsMem.va_code_DestroyHeaplets", "Prims.Nil", "Vale.X64.Machine_s.precode", "Vale.X64.Decls.ins", "Vale.X64.Decls.ocmp", "Vale.X64.Decls.va_state", "Vale.X64.QuickCodes.va_QSeq", "Vale.X64.QuickCodes.va_range1", "Vale.X64.InsMem.va_quick_CreateHeaplets", "Vale.Arch.HeapImpl.buffer_info", "Vale.X64.InsMem.declare_buffer64", "Vale.Arch.HeapTypes_s.Secret", "Vale.Arch.HeapImpl.Immutable", "Vale.Arch.HeapImpl.Mutable", "Vale.X64.InsBasic.va_quick_LargeComment", "Vale.Curve25519.X64.FastMul.va_quick_Fast_multiply", "Vale.X64.InsBasic.va_quick_Newline", "Vale.X64.InsBasic.va_quick_Comment", "Vale.X64.InsBasic.va_quick_Mov64", "Vale.Curve25519.X64.FastHybrid.va_quick_Carry_wide", "Vale.X64.InsMem.va_quick_DestroyHeaplets", "Vale.X64.QuickCodes.va_QEmpty", "Vale.Def.Words_s.nat64", "Vale.X64.Decls.va_get_reg64", "Vale.X64.Machine_s.rRcx", "Vale.X64.State.vale_state", "Vale.X64.QuickCodes.quickCodes", "Vale.X64.QuickCode.va_quickCode", "Vale.Curve25519.X64.FastWide.va_code_Fmul2" ]
[]
false
false
false
false
false
let va_qcode_Fmul2 (va_mods: va_mods_t) (tmp_b inA_b dst_b inB_b: buffer64) : (va_quickCode unit (va_code_Fmul2 ())) =
(qblock va_mods (fun (va_s: va_state) -> let va_old_s:va_state = va_s in let tmp_in:nat64 = va_get_reg64 rRdi va_s in let inA_in:nat64 = va_get_reg64 rRsi va_s in let dst_in:nat64 = va_get_reg64 rR15 va_s in let inB_in:nat64 = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 334 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([ declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable ])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 340 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]") (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 4 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 344 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers") (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the results back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 349 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 350 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 351 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 4 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 353 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_codegen_success_Fmul_stdcall
val va_codegen_success_Fmul_stdcall : win:bool -> Tot va_pbool
val va_codegen_success_Fmul_stdcall : win:bool -> Tot va_pbool
let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ()))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 89, "end_line": 205, "start_col": 0, "start_line": 187 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ())))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
win: Prims.bool -> Vale.X64.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Prims.bool", "Vale.X64.Decls.va_pbool_and", "Vale.X64.InsStack.va_codegen_success_Push_Secret", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR15", "Vale.X64.Machine_s.rRbx", "Vale.X64.Machine_s.rRsi", "Vale.X64.Machine_s.rRdi", "Vale.X64.InsBasic.va_codegen_success_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRdx", "Vale.X64.Machine_s.rR8", "Vale.X64.Machine_s.rR9", "Vale.X64.Decls.va_ttrue", "Vale.X64.Decls.va_pbool", "Vale.Curve25519.X64.FastWide.va_codegen_success_Fmul", "Vale.X64.InsStack.va_codegen_success_Pop_Secret" ]
[]
false
false
false
true
false
let va_codegen_success_Fmul_stdcall win =
(va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi) ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi ) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi )) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx )) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15 )) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ()))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_code_Fmul2_stdcall
val va_code_Fmul2_stdcall : win:bool -> Tot va_code
val va_code_Fmul2_stdcall : win:bool -> Tot va_code
let va_code_Fmul2_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul2 ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ())))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 58, "end_line": 584, "start_col": 0, "start_line": 568 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2 [@ "opaque_to_smt" va_qattr] let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2 () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2 (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 334 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 340 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 4 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 344 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the results back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 349 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 350 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 351 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 4 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 353 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2 va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2 va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 286 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 287 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 288 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 290 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 291 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 293 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 295 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 296 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 298 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 299 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 300 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 301 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 303 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 304 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 305 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 306 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 312 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 313 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 314 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 316 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 319 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 320 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 321 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 323 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 325 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 326 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2 tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2 (va_code_Fmul2 ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2_stdcall
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
win: Prims.bool -> Vale.X64.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Prims.bool", "Vale.X64.Decls.va_Block", "Vale.X64.Decls.va_CCons", "Vale.X64.InsStack.va_code_Push_Secret", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR15", "Vale.X64.Machine_s.rRbx", "Vale.X64.Machine_s.rRsi", "Vale.X64.Machine_s.rRdi", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRdx", "Vale.X64.Machine_s.rR8", "Vale.X64.Machine_s.rR9", "Vale.X64.Decls.va_CNil", "Vale.X64.Decls.va_code", "Vale.Curve25519.X64.FastWide.va_code_Fmul2", "Vale.X64.InsStack.va_code_Pop_Secret" ]
[]
false
false
false
true
false
let va_code_Fmul2_stdcall win =
(va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx ) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul2 ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi )) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi) ) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13 )) (va_CNil ())))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_codegen_success_Fmul2_stdcall
val va_codegen_success_Fmul2_stdcall : win:bool -> Tot va_pbool
val va_codegen_success_Fmul2_stdcall : win:bool -> Tot va_pbool
let va_codegen_success_Fmul2_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul2 ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ()))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 89, "end_line": 605, "start_col": 0, "start_line": 587 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2 [@ "opaque_to_smt" va_qattr] let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2 () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2 (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 334 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 340 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 4 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 344 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the results back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 349 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 350 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 351 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 4 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 353 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2 va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2 va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 286 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 287 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 288 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 290 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 291 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 293 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 295 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 296 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 298 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 299 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 300 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 301 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 303 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 304 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 305 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 306 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 312 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 313 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 314 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 316 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 319 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 320 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 321 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 323 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 325 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 326 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2 tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2 (va_code_Fmul2 ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul2_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul2 ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ())))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
win: Prims.bool -> Vale.X64.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Prims.bool", "Vale.X64.Decls.va_pbool_and", "Vale.X64.InsStack.va_codegen_success_Push_Secret", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR15", "Vale.X64.Machine_s.rRbx", "Vale.X64.Machine_s.rRsi", "Vale.X64.Machine_s.rRdi", "Vale.X64.InsBasic.va_codegen_success_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRdx", "Vale.X64.Machine_s.rR8", "Vale.X64.Machine_s.rR9", "Vale.X64.Decls.va_ttrue", "Vale.X64.Decls.va_pbool", "Vale.Curve25519.X64.FastWide.va_codegen_success_Fmul2", "Vale.X64.InsStack.va_codegen_success_Pop_Secret" ]
[]
false
false
false
true
false
let va_codegen_success_Fmul2_stdcall win =
(va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi) ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi ) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul2 ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi )) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx )) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15 )) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ()))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_codegen_success_Fsqr
val va_codegen_success_Fsqr : va_dummy:unit -> Tot va_pbool
val va_codegen_success_Fsqr : va_dummy:unit -> Tot va_pbool
let va_codegen_success_Fsqr () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_pbool_and (va_codegen_success_Fast_sqr 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 67, "end_line": 836, "start_col": 0, "start_line": 824 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2 [@ "opaque_to_smt" va_qattr] let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2 () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2 (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 334 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 340 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 4 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 344 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the results back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 349 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 350 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 351 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 4 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 353 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2 va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2 va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 286 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 287 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 288 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 290 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 291 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 293 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 295 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 296 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 298 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 299 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 300 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 301 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 303 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 304 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 305 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 306 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 312 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 313 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 314 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 316 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 319 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 320 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 321 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 323 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 325 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 326 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2 tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2 (va_code_Fmul2 ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul2_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul2 ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul2 ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 455 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 456 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 457 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 458 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 461 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 464 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 465 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 467 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 468 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 469 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 470 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 474 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul2 tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 479 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 481 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 482 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 485 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 486 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 488 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 356 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 390 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 391 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 392 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 393 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 395 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 396 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 397 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 398 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 400 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 401 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 403 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 404 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 405 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 410 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 411 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 413 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 414 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 416 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 417 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 418 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 419 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 423 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 424 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 425 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 426 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 428 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 431 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 437 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 439 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 440 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 441 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 442 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 443 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 444 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 445 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 446 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 447 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 448 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 449 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 450 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 451 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 453 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2_stdcall (va_code_Fmul2_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fsqr [@ "opaque_to_smt" va_qattr] let va_code_Fsqr () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_CCons (va_code_Fast_sqr 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.X64.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.X64.Decls.va_pbool_and", "Vale.X64.InsMem.va_codegen_success_CreateHeaplets", "Vale.X64.InsBasic.va_codegen_success_LargeComment", "Vale.Curve25519.X64.FastSqr.va_codegen_success_Fast_sqr", "Vale.X64.InsBasic.va_codegen_success_Newline", "Vale.X64.InsBasic.va_codegen_success_Comment", "Vale.X64.InsBasic.va_codegen_success_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRsi", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rR12", "Vale.Curve25519.X64.FastHybrid.va_codegen_success_Carry_wide", "Vale.X64.InsMem.va_codegen_success_DestroyHeaplets", "Vale.X64.Decls.va_ttrue", "Vale.X64.Decls.va_pbool" ]
[]
false
false
false
true
false
let va_codegen_success_Fsqr () =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- f * f") (va_pbool_and (va_codegen_success_Fast_sqr 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers") (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_qcode_Fsqr
val va_qcode_Fsqr (va_mods: va_mods_t) (tmp_b inA_b dst_b: buffer64) : (va_quickCode unit (va_code_Fsqr ()))
val va_qcode_Fsqr (va_mods: va_mods_t) (tmp_b inA_b dst_b: buffer64) : (va_quickCode unit (va_code_Fsqr ()))
let va_qcode_Fsqr (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) : (va_quickCode unit (va_code_Fsqr ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR12 va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 541 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 546 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 547 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_sqr 0 tmp_b inA_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 549 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 550 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 551 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 552 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 554 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 555 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 557 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 61, "end_line": 870, "start_col": 0, "start_line": 839 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2 [@ "opaque_to_smt" va_qattr] let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2 () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2 (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 334 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 340 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 4 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 344 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the results back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 349 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 350 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 351 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 4 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 353 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2 va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2 va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 286 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 287 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 288 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 290 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 291 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 293 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 295 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 296 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 298 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 299 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 300 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 301 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 303 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 304 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 305 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 306 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 312 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 313 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 314 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 316 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 319 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 320 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 321 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 323 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 325 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 326 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2 tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2 (va_code_Fmul2 ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul2_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul2 ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul2 ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 455 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 456 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 457 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 458 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 461 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 464 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 465 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 467 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 468 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 469 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 470 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 474 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul2 tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 479 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 481 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 482 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 485 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 486 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 488 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 356 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 390 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 391 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 392 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 393 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 395 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 396 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 397 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 398 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 400 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 401 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 403 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 404 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 405 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 410 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 411 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 413 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 414 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 416 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 417 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 418 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 419 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 423 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 424 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 425 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 426 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 428 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 431 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 437 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 439 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 440 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 441 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 442 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 443 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 444 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 445 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 446 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 447 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 448 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 449 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 450 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 451 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 453 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2_stdcall (va_code_Fmul2_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fsqr [@ "opaque_to_smt" va_qattr] let va_code_Fsqr () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_CCons (va_code_Fast_sqr 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fsqr () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_pbool_and (va_codegen_success_Fast_sqr 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_mods: Vale.X64.QuickCode.va_mods_t -> tmp_b: Vale.X64.Memory.buffer64 -> inA_b: Vale.X64.Memory.buffer64 -> dst_b: Vale.X64.Memory.buffer64 -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Curve25519.X64.FastWide.va_code_Fsqr ())
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.QuickCode.va_mods_t", "Vale.X64.Memory.buffer64", "Vale.X64.QuickCodes.qblock", "Prims.unit", "Prims.Cons", "Vale.X64.Decls.va_code", "Vale.X64.InsMem.va_code_CreateHeaplets", "Vale.X64.InsBasic.va_code_LargeComment", "Vale.Curve25519.X64.FastSqr.va_code_Fast_sqr", "Vale.X64.InsBasic.va_code_Newline", "Vale.X64.InsBasic.va_code_Comment", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRsi", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rR12", "Vale.Curve25519.X64.FastHybrid.va_code_Carry_wide", "Vale.X64.InsMem.va_code_DestroyHeaplets", "Prims.Nil", "Vale.X64.Machine_s.precode", "Vale.X64.Decls.ins", "Vale.X64.Decls.ocmp", "Vale.X64.Decls.va_state", "Vale.X64.QuickCodes.va_QSeq", "Vale.X64.QuickCodes.va_range1", "Vale.X64.InsMem.va_quick_CreateHeaplets", "Vale.Arch.HeapImpl.buffer_info", "Vale.X64.InsMem.declare_buffer64", "Vale.Arch.HeapTypes_s.Secret", "Vale.Arch.HeapImpl.Immutable", "Vale.Arch.HeapImpl.Mutable", "Vale.X64.InsBasic.va_quick_LargeComment", "Vale.Curve25519.X64.FastSqr.va_quick_Fast_sqr", "Vale.X64.InsBasic.va_quick_Newline", "Vale.X64.InsBasic.va_quick_Comment", "Vale.X64.InsBasic.va_quick_Mov64", "Vale.Curve25519.X64.FastHybrid.va_quick_Carry_wide", "Vale.X64.InsMem.va_quick_DestroyHeaplets", "Vale.X64.QuickCodes.va_QEmpty", "Vale.Def.Words_s.nat64", "Vale.X64.Decls.va_get_reg64", "Vale.X64.State.vale_state", "Vale.X64.QuickCodes.quickCodes", "Vale.X64.QuickCode.va_quickCode", "Vale.Curve25519.X64.FastWide.va_code_Fsqr" ]
[]
false
false
false
false
false
let va_qcode_Fsqr (va_mods: va_mods_t) (tmp_b inA_b dst_b: buffer64) : (va_quickCode unit (va_code_Fsqr ())) =
(qblock va_mods (fun (va_s: va_state) -> let va_old_s:va_state = va_s in let tmp_in:nat64 = va_get_reg64 rRdi va_s in let inA_in:nat64 = va_get_reg64 rRsi va_s in let dst_in:nat64 = va_get_reg64 rR12 va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 541 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([ declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable ])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 546 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- f * f") (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 547 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_sqr 0 tmp_b inA_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 549 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 550 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers") (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 551 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 552 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 554 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field") (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 555 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 557 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))))))))
false
Eq.fst
Eq.eq_instance_of_eqtype
val eq_instance_of_eqtype (#a: eqtype) : deq a
val eq_instance_of_eqtype (#a: eqtype) : deq a
let eq_instance_of_eqtype (#a:eqtype) : deq a = Mkdeq (fun x y -> x = y) (fun x y -> ())
{ "file_name": "examples/typeclasses/Eq.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 42, "end_line": 32, "start_col": 0, "start_line": 31 }
(* 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 Eq open FStar.Tactics.Typeclasses (* A class for decidable equality *) class deq a = { eq : a -> a -> bool; eq_ok : (x:a) -> (y:a) -> Lemma (eq x y <==> x == y) } (* These methods are generated by the splice *) (* [@@tcnorm] let eq_ok (#a:Type) {|d : deq a|} = d.eq_ok *) (* [@@tcnorm] let eq (#a:Type) {|d : deq a|} = d.eq *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.Typeclasses.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Eq.fst" }
[ { "abbrev": false, "full_module": "FStar.Tactics.Typeclasses", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Eq.deq a
Prims.Tot
[ "total" ]
[]
[ "Prims.eqtype", "Eq.Mkdeq", "Prims.op_Equality", "Prims.bool", "Prims.unit", "Eq.deq" ]
[]
false
false
false
false
false
let eq_instance_of_eqtype (#a: eqtype) : deq a =
Mkdeq (fun x y -> x = y) (fun x y -> ())
false
Eq.fst
Eq.eqList
val eqList {| _: deq 'a |} (xs ys: list 'a) : Tot (b: bool{b <==> xs == ys})
val eqList {| _: deq 'a |} (xs ys: list 'a) : Tot (b: bool{b <==> xs == ys})
let rec eqList {|deq 'a|} (xs ys : list 'a) : Tot (b:bool{b <==> xs == ys}) = match xs, ys with | [], [] -> true | x::xs, y::ys -> eq_ok x y; eq x y && eqList xs ys | _, _ -> false
{ "file_name": "examples/typeclasses/Eq.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 17, "end_line": 43, "start_col": 0, "start_line": 39 }
(* 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 Eq open FStar.Tactics.Typeclasses (* A class for decidable equality *) class deq a = { eq : a -> a -> bool; eq_ok : (x:a) -> (y:a) -> Lemma (eq x y <==> x == y) } (* These methods are generated by the splice *) (* [@@tcnorm] let eq_ok (#a:Type) {|d : deq a|} = d.eq_ok *) (* [@@tcnorm] let eq (#a:Type) {|d : deq a|} = d.eq *) (* A way to get `deq a` for any `a : eqtype` *) let eq_instance_of_eqtype (#a:eqtype) : deq a = Mkdeq (fun x y -> x = y) (fun x y -> ()) (* Two concrete instances *) instance _ : deq int = eq_instance_of_eqtype instance _ : deq bool = eq_instance_of_eqtype instance _ : deq string = eq_instance_of_eqtype
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.Typeclasses.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Eq.fst" }
[ { "abbrev": false, "full_module": "FStar.Tactics.Typeclasses", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
{| _: Eq.deq 'a |} -> xs: Prims.list 'a -> ys: Prims.list 'a -> b: Prims.bool{b <==> xs == ys}
Prims.Tot
[ "total" ]
[]
[ "Eq.deq", "Prims.list", "FStar.Pervasives.Native.Mktuple2", "Prims.op_AmpAmp", "Eq.eq", "Eq.eqList", "Prims.unit", "Eq.eq_ok", "Prims.bool", "Prims.l_iff", "Prims.b2t", "Prims.eq2" ]
[ "recursion" ]
false
false
false
false
false
let rec eqList {| _: deq 'a |} (xs ys: list 'a) : Tot (b: bool{b <==> xs == ys}) =
match xs, ys with | [], [] -> true | x :: xs, y :: ys -> eq_ok x y; eq x y && eqList xs ys | _, _ -> false
false
Eq.fst
Eq.eq_list
[@@ FStar.Tactics.Typeclasses.tcinstance] val eq_list: deq 'a -> deq (list 'a)
[@@ FStar.Tactics.Typeclasses.tcinstance] val eq_list: deq 'a -> deq (list 'a)
instance eq_list (_ : deq 'a) : deq (list 'a) = Mkdeq eqList (fun x y -> ())
{ "file_name": "examples/typeclasses/Eq.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 47, "start_col": 0, "start_line": 46 }
(* 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 Eq open FStar.Tactics.Typeclasses (* A class for decidable equality *) class deq a = { eq : a -> a -> bool; eq_ok : (x:a) -> (y:a) -> Lemma (eq x y <==> x == y) } (* These methods are generated by the splice *) (* [@@tcnorm] let eq_ok (#a:Type) {|d : deq a|} = d.eq_ok *) (* [@@tcnorm] let eq (#a:Type) {|d : deq a|} = d.eq *) (* A way to get `deq a` for any `a : eqtype` *) let eq_instance_of_eqtype (#a:eqtype) : deq a = Mkdeq (fun x y -> x = y) (fun x y -> ()) (* Two concrete instances *) instance _ : deq int = eq_instance_of_eqtype instance _ : deq bool = eq_instance_of_eqtype instance _ : deq string = eq_instance_of_eqtype let rec eqList {|deq 'a|} (xs ys : list 'a) : Tot (b:bool{b <==> xs == ys}) = match xs, ys with | [], [] -> true | x::xs, y::ys -> eq_ok x y; eq x y && eqList xs ys | _, _ -> false
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.Typeclasses.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Eq.fst" }
[ { "abbrev": false, "full_module": "FStar.Tactics.Typeclasses", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Eq.deq 'a -> Eq.deq (Prims.list 'a)
Prims.Tot
[ "total" ]
[]
[ "Eq.deq", "Eq.Mkdeq", "Prims.list", "Eq.eqList", "Prims.unit" ]
[]
false
false
false
true
false
[@@ FStar.Tactics.Typeclasses.tcinstance] let eq_list (_: deq 'a) : deq (list 'a) =
Mkdeq eqList (fun x y -> ())
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_codegen_success_Fsqr_stdcall
val va_codegen_success_Fsqr_stdcall : win:bool -> Tot va_pbool
val va_codegen_success_Fsqr_stdcall : win:bool -> Tot va_pbool
let va_codegen_success_Fsqr_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rR8)) (va_ttrue ()))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fsqr ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_ttrue ()))))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 91, "end_line": 980, "start_col": 0, "start_line": 961 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2 [@ "opaque_to_smt" va_qattr] let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2 () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2 (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 334 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 340 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 4 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 344 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the results back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 349 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 350 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 351 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 4 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 353 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2 va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2 va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 286 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 287 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 288 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 290 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 291 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 293 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 295 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 296 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 298 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 299 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 300 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 301 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 303 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 304 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 305 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 306 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 312 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 313 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 314 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 316 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 319 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 320 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 321 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 323 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 325 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 326 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2 tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2 (va_code_Fmul2 ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul2_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul2 ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul2 ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 455 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 456 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 457 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 458 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 461 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 464 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 465 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 467 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 468 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 469 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 470 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 474 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul2 tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 479 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 481 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 482 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 485 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 486 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 488 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 356 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 390 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 391 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 392 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 393 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 395 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 396 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 397 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 398 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 400 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 401 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 403 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 404 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 405 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 410 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 411 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 413 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 414 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 416 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 417 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 418 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 419 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 423 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 424 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 425 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 426 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 428 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 431 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 437 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 439 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 440 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 441 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 442 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 443 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 444 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 445 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 446 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 447 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 448 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 449 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 450 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 451 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 453 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2_stdcall (va_code_Fmul2_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fsqr [@ "opaque_to_smt" va_qattr] let va_code_Fsqr () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_CCons (va_code_Fast_sqr 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fsqr () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_pbool_and (va_codegen_success_Fast_sqr 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fsqr (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) : (va_quickCode unit (va_code_Fsqr ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR12 va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 541 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 546 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 547 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_sqr 0 tmp_b inA_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 549 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 550 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 551 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 552 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 554 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 555 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 557 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fsqr va_b0 va_s0 tmp_b inA_b dst_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fsqr va_mods tmp_b inA_b dst_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fsqr ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 491 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR12 va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 517 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 518 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 519 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 520 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 522 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 523 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 524 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 525 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 527 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 528 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 530 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a a `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 536 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rR12 va_s0 == va_get_reg64 rR12 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 538 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fsqr tmp_b inA_b dst_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fsqr (va_code_Fsqr ()) va_s0 tmp_b inA_b dst_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fsqr_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fsqr_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR12)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rR8)) (va_CNil ())))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fsqr ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR12)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CNil ())))))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
win: Prims.bool -> Vale.X64.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Prims.bool", "Vale.X64.Decls.va_pbool_and", "Vale.X64.InsStack.va_codegen_success_Push_Secret", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.X64.Machine_s.rR15", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR12", "Vale.X64.Machine_s.rRbx", "Vale.X64.Machine_s.rRsi", "Vale.X64.Machine_s.rRdi", "Vale.X64.InsBasic.va_codegen_success_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRdx", "Vale.X64.Machine_s.rR8", "Vale.X64.Decls.va_ttrue", "Vale.X64.Decls.va_pbool", "Vale.Curve25519.X64.FastWide.va_codegen_success_Fsqr", "Vale.X64.InsStack.va_codegen_success_Pop_Secret" ]
[]
false
false
false
true
false
let va_codegen_success_Fsqr_stdcall win =
(va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi )) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi )) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi ) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rR8)) (va_ttrue ()))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fsqr ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx )) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_ttrue ()))))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_code_Fsqr_stdcall
val va_code_Fsqr_stdcall : win:bool -> Tot va_code
val va_code_Fsqr_stdcall : win:bool -> Tot va_code
let va_code_Fsqr_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR12)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rR8)) (va_CNil ())))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fsqr ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR12)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CNil ())))))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 90, "end_line": 958, "start_col": 0, "start_line": 942 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2 [@ "opaque_to_smt" va_qattr] let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2 () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2 (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 334 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 340 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 4 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 344 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the results back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 349 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 350 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 351 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 4 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 353 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2 va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2 va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 286 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 287 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 288 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 290 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 291 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 293 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 295 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 296 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 298 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 299 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 300 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 301 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 303 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 304 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 305 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 306 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 312 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 313 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 314 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 316 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 319 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 320 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 321 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 323 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 325 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 326 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2 tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2 (va_code_Fmul2 ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul2_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul2 ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul2 ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 455 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 456 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 457 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 458 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 461 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 464 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 465 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 467 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 468 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 469 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 470 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 474 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul2 tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 479 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 481 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 482 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 485 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 486 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 488 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 356 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 390 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 391 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 392 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 393 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 395 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 396 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 397 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 398 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 400 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 401 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 403 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 404 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 405 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 410 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 411 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 413 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 414 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 416 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 417 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 418 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 419 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 423 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 424 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 425 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 426 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 428 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 431 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 437 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 439 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 440 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 441 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 442 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 443 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 444 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 445 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 446 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 447 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 448 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 449 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 450 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 451 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 453 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2_stdcall (va_code_Fmul2_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fsqr [@ "opaque_to_smt" va_qattr] let va_code_Fsqr () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_CCons (va_code_Fast_sqr 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fsqr () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_pbool_and (va_codegen_success_Fast_sqr 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fsqr (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) : (va_quickCode unit (va_code_Fsqr ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR12 va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 541 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 546 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 547 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_sqr 0 tmp_b inA_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 549 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 550 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 551 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 552 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 554 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 555 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 557 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fsqr va_b0 va_s0 tmp_b inA_b dst_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fsqr va_mods tmp_b inA_b dst_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fsqr ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 491 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR12 va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 517 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 518 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 519 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 520 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 522 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 523 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 524 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 525 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 527 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 528 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 530 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a a `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 536 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rR12 va_s0 == va_get_reg64 rR12 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 538 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fsqr tmp_b inA_b dst_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fsqr (va_code_Fsqr ()) va_s0 tmp_b inA_b dst_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fsqr_stdcall
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
win: Prims.bool -> Vale.X64.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Prims.bool", "Vale.X64.Decls.va_Block", "Vale.X64.Decls.va_CCons", "Vale.X64.InsStack.va_code_Push_Secret", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.X64.Machine_s.rR15", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR12", "Vale.X64.Machine_s.rRbx", "Vale.X64.Machine_s.rRsi", "Vale.X64.Machine_s.rRdi", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRdx", "Vale.X64.Machine_s.rR8", "Vale.X64.Decls.va_CNil", "Vale.X64.Decls.va_code", "Vale.Curve25519.X64.FastWide.va_code_Fsqr", "Vale.X64.InsStack.va_code_Pop_Secret" ]
[]
false
false
false
true
false
let va_code_Fsqr_stdcall win =
(va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR12)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi) ) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12 ) (va_op_opr64_reg64 rR8)) (va_CNil ())))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fsqr ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi )) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR12)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14 )) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CNil ())))))))))))))))
false
Vale.Curve25519.X64.FastWide.fst
Vale.Curve25519.X64.FastWide.va_code_Fsqr
val va_code_Fsqr : va_dummy:unit -> Tot va_code
val va_code_Fsqr : va_dummy:unit -> Tot va_code
let va_code_Fsqr () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- f * f" ) (va_CCons (va_code_Fast_sqr 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))))))))))
{ "file_name": "obj/Vale.Curve25519.X64.FastWide.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 18, "end_line": 821, "start_col": 0, "start_line": 811 }
module Vale.Curve25519.X64.FastWide open Vale.Def.Types_s open Vale.Arch.Types open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsStack open Vale.X64.QuickCode open Vale.X64.QuickCodes open FStar.Tactics open Vale.Curve25519.Fast_defs open Vale.Curve25519.Fast_lemmas_external //open Vale.Curve25519.FastHybrid_helpers //open Vale.Curve25519.FastUtil_helpers open Vale.X64.CPU_Features_s open Vale.Curve25519.X64.FastMul open Vale.Curve25519.X64.FastSqr open Vale.Curve25519.X64.FastHybrid #reset-options "--z3rlimit 60" //-- Fmul [@ "opaque_to_smt" va_qattr] let va_code_Fmul () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the result back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 119 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 125 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication: tmp <- src1 * src2" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 126 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 127 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 128 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 129 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 130 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 131 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the result back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 132 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 134 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 92 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 93 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 94 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 95 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 98 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 99 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 100 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 102 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 103 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 105 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 107 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 108 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 109 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 111 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 117 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul (va_code_Fmul ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 216 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 217 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 218 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 221 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 225 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 227 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 228 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 229 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 230 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 234 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 237 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 239 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 241 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 242 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 245 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 246 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 247 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul_stdcall (va_code_Fmul_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2 [@ "opaque_to_smt" va_qattr] let va_code_Fmul2 () = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_CCons (va_code_Fast_multiply 0) (va_CCons (va_code_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_CCons (va_code_Fast_multiply 4) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers" ) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_LargeComment "Wrap the results back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Carry_wide 4) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2 () = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_pbool_and (va_codegen_success_Fast_multiply 0) (va_pbool_and (va_codegen_success_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_pbool_and (va_codegen_success_Fast_multiply 4) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Comment "Line up pointers" ) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_LargeComment "Wrap the results back into the field" ) (va_pbool_and (va_codegen_success_Carry_wide 0) (va_pbool_and (va_codegen_success_Newline ()) (va_pbool_and (va_codegen_success_Carry_wide 4) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2 (va_mods:va_mods_t) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:nat64) = va_get_reg64 rRdi va_s in let (inA_in:nat64) = va_get_reg64 rRsi va_s in let (dst_in:nat64) = va_get_reg64 rR15 va_s in let (inB_in:nat64) = va_get_reg64 rRcx va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 334 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 inA_b 0 Secret Immutable; declare_buffer64 inB_b 0 Secret Immutable; declare_buffer64 dst_b 0 Secret Mutable; declare_buffer64 tmp_b 0 Secret Mutable])) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 340 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[0] <- f1[0] * f2[0]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 0 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Compute the raw multiplication tmp[1] <- f1[1] * f2[1]" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fast_multiply 4 tmp_b inA_b inB_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 344 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Comment "Line up pointers" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_LargeComment "Wrap the results back into the field" ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 349 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 0 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 350 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Newline ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 351 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Carry_wide 4 dst_b tmp_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 353 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2 va_b0 va_s0 tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2 va_mods tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 286 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 287 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 288 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 290 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 291 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 293 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 295 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 296 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 298 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 299 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 300 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 301 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 303 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 304 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 305 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 306 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 312 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 313 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 314 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 316 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 319 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 320 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 321 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 323 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 325 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 326 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2 tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2 (va_code_Fmul2 ()) va_s0 tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fmul2_stdcall [@ "opaque_to_smt" va_qattr] let va_code_Fmul2_stdcall win = (va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_CCons (if win then va_Block (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_CCons (va_code_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CNil ()))))))) else va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_CNil ()))) (va_CCons (va_code_Fmul2 ()) (va_CCons (if win then va_Block (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_CNil ()))) else va_Block (va_CNil ())) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_CCons (va_code_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Fmul2_stdcall win = (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_pbool_and (va_codegen_success_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_ttrue ())))))) else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Fmul2 ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_ttrue ())) else va_ttrue ()) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_pbool_and (va_codegen_success_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Fmul2_stdcall (va_mods:va_mods_t) (win:bool) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : (va_quickCode unit (va_code_Fmul2_stdcall win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _ -> va_get_reg64 rRdx va_s) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 455 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 456 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 457 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 458 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 461 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 464 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 465 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 467 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 468 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 469 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 470 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (()))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 474 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR15) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Fmul2 tmp_b inA_b dst_b inB_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 479 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 481 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 482 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QEmpty (()))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 485 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 486 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 488 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QEmpty (())))))))))))))) [@"opaque_to_smt"] let va_lemma_Fmul2_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b = let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Fmul2_stdcall va_mods win tmp_b inA_b dst_b inB_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2_stdcall win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 356 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_ok va_sM) /\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 390 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 391 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 392 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 393 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 395 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 396 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 397 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 398 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 400 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1 "***** POSTCONDITION NOT MET AT line 401 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1 "***** POSTCONDITION NOT MET AT line 403 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 404 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 405 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 410 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 411 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 413 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1 "***** POSTCONDITION NOT MET AT line 414 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1 "***** POSTCONDITION NOT MET AT line 416 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 417 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 418 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 419 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1 "***** POSTCONDITION NOT MET AT line 423 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 424 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 425 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 426 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 428 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 431 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 437 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 439 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 440 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 441 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 442 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 443 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 444 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 445 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 446 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 447 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 448 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 449 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 450 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 451 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 453 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****" (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0))))))))))))))))))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Fmul2_stdcall win tmp_b inA_b dst_b inB_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Fmul2_stdcall (va_code_Fmul2_stdcall win) va_s0 win tmp_b inA_b dst_b inB_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Fsqr
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Def.Types_s.fst.checked", "Vale.Curve25519.X64.FastSqr.fsti.checked", "Vale.Curve25519.X64.FastMul.fsti.checked", "Vale.Curve25519.X64.FastHybrid.fsti.checked", "Vale.Curve25519.Fast_lemmas_external.fsti.checked", "Vale.Curve25519.Fast_defs.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Curve25519.X64.FastWide.fst" }
[ { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastHybrid", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastSqr", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64.FastMul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_lemmas_external", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.Fast_defs", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Curve25519.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.X64.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.X64.Decls.va_Block", "Vale.X64.Decls.va_CCons", "Vale.X64.InsMem.va_code_CreateHeaplets", "Vale.X64.InsBasic.va_code_LargeComment", "Vale.Curve25519.X64.FastSqr.va_code_Fast_sqr", "Vale.X64.InsBasic.va_code_Newline", "Vale.X64.InsBasic.va_code_Comment", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRsi", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rR12", "Vale.Curve25519.X64.FastHybrid.va_code_Carry_wide", "Vale.X64.InsMem.va_code_DestroyHeaplets", "Vale.X64.Decls.va_CNil", "Vale.X64.Decls.va_code" ]
[]
false
false
false
true
false
let va_code_Fsqr () =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_LargeComment "Compute the raw multiplication: tmp <- f * f") (va_CCons (va_code_Fast_sqr 0) (va_CCons (va_code_Newline ()) (va_CCons (va_code_Comment "Line up pointers") (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_LargeComment "Wrap the result back into the field" ) (va_CCons (va_code_Carry_wide 0) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))))))) ))
false