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
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.close_pattern_with_not_free_var
val close_pattern_with_not_free_var (p: R.pattern) (x: var) (i: nat) : Lemma (requires ~(Set.mem x (freevars_pattern p))) (ensures subst_pattern p [ND x i] == p) (decreases p)
val close_pattern_with_not_free_var (p: R.pattern) (x: var) (i: nat) : Lemma (requires ~(Set.mem x (freevars_pattern p))) (ensures subst_pattern p [ND x i] == p) (decreases p)
let rec close_with_not_free_var (t:R.term) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars t))) (ensures subst_term t [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Var _ | Tv_BVar _ | Tv_FVar _ | Tv_UInst _ _ -> () | Tv_App hd (arg, _) -> close_with_not_free_var hd x i; close_with_not_free_var arg x i | Tv_Abs b body -> close_binder_with_not_free_var b x i; close_with_not_free_var body x (i + 1) | Tv_Arrow b c -> close_binder_with_not_free_var b x i; close_comp_with_not_free_var c x (i + 1) | Tv_Type _ -> () | Tv_Refine b t -> close_binder_with_not_free_var b x i; close_with_not_free_var t x (i + 1) | Tv_Const _ -> () | Tv_Uvar _ _ -> assert False | Tv_Let recf attrs b e1 e2 -> close_terms_with_not_free_var attrs x i; close_binder_with_not_free_var b x i; (if recf then close_with_not_free_var e1 x (i + 1) else close_with_not_free_var e1 x i); close_with_not_free_var e2 x (i + 1) | Tv_Match scrutinee ret_opt brs -> close_with_not_free_var scrutinee x i; (match ret_opt with | None -> () | Some ret -> close_match_returns_with_not_free_var ret x i); close_branches_with_not_free_var brs x i | Tv_AscribedT e t tacopt _ -> close_with_not_free_var e x i; close_with_not_free_var t x i; (match tacopt with | None -> () | Some tac -> close_with_not_free_var tac x i) | Tv_AscribedC e c tacopt _ -> close_with_not_free_var e x i; close_comp_with_not_free_var c x i; (match tacopt with | None -> () | Some tac -> close_with_not_free_var tac x i) | Tv_Unknown -> () | Tv_Unsupp -> () and close_match_returns_with_not_free_var (r:match_returns_ascription) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_match_returns r))) (ensures subst_match_returns r [ ND x i ] == r) (decreases r) = let b, (ret, as_opt, _) = r in close_binder_with_not_free_var b x i; (match ret with | Inl t -> close_with_not_free_var t x (i + 1) | Inr c -> close_comp_with_not_free_var c x (i + 1)); (match as_opt with | None -> () | Some t -> close_with_not_free_var t x (i + 1)) and close_branches_with_not_free_var (brs:list R.branch) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_branches brs))) (ensures subst_branches brs [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | hd::tl -> close_branch_with_not_free_var hd x i; close_branches_with_not_free_var tl x i and close_branch_with_not_free_var (br:R.branch) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_branch br))) (ensures subst_branch br [ ND x i ] == br) (decreases br) = let p, t = br in close_pattern_with_not_free_var p x i; close_with_not_free_var t x (binder_offset_pattern p + i) and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_pattern p))) (ensures subst_pattern p [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons _ _ pats -> close_patterns_with_not_free_var pats x i | Pat_Var bv _ -> () | Pat_Dot_Term topt -> (match topt with | None -> () | Some t -> close_with_not_free_var t x i) and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_patterns l))) (ensures subst_patterns l [ ND x i ] == l) (decreases l) = match l with | [] -> () | (p, _)::tl -> close_pattern_with_not_free_var p x i; close_patterns_with_not_free_var tl x (binder_offset_pattern p + i) and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_terms l))) (ensures subst_terms l [ ND x i ] == l) (decreases l) = match l with | [] -> () | hd::tl -> close_with_not_free_var hd x i; close_terms_with_not_free_var tl x i and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_binder b))) (ensures subst_binder b [ ND x i ] == b) (decreases b) = let {attrs; sort} = inspect_binder b in close_with_not_free_var sort x i; close_terms_with_not_free_var attrs x i and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_comp c))) (ensures subst_comp c [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_with_not_free_var t x i | C_Lemma pre post pats -> close_with_not_free_var pre x i; close_with_not_free_var post x i; close_with_not_free_var pats x i | C_Eff _ _ t args decrs -> close_with_not_free_var t x i; close_args_with_not_free_var args x i; close_terms_with_not_free_var decrs x i and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_args l))) (ensures subst_args l [ ND x i ] == l) (decreases l) = match l with | [] -> () | (t, _)::tl -> close_with_not_free_var t x i; close_args_with_not_free_var tl x i
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 39, "end_line": 747, "start_col": 0, "start_line": 570 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss) let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in () let open_close_inverse (e:R.term { ln e }) (x:var) : Lemma (open_term (close_term e x) x == e) = close_term_spec e x; open_term_spec (close_term e x) x; open_close_inverse' 0 e x let rec close_open_inverse' (i:nat) (t:term) (x:var { ~(x `Set.mem` freevars t) }) : Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Uvar _ _ -> assert false | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> () | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> close_open_inverse' i t1 x; close_open_inverse' i (fst a) x | Tv_Abs b body -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) body x | Tv_Arrow b c -> close_open_inverse'_binder i b x; close_open_inverse'_comp (i + 1) c x | Tv_Refine b f -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> close_open_inverse'_terms i attrs x; close_open_inverse'_binder i b x; close_open_inverse' (if recf then (i + 1) else i) def x; close_open_inverse' (i + 1) body x | Tv_Match scr ret brs -> close_open_inverse' i scr x; (match ret with | None -> () | Some m -> close_open_inverse'_match_returns i m x); close_open_inverse'_branches i brs x | Tv_AscribedT e t tac b -> close_open_inverse' i e x; close_open_inverse' i t x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) | Tv_AscribedC e c tac b -> close_open_inverse' i e x; close_open_inverse'_comp i c x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) and close_open_inverse'_comp (i:nat) (c:comp) (x:var{ ~(x `Set.mem` freevars_comp c) }) : Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_open_inverse' i t x | C_Lemma pre post pats -> close_open_inverse' i pre x; close_open_inverse' i post x; close_open_inverse' i pats x | C_Eff us eff_name res args decrs -> close_open_inverse' i res x; close_open_inverse'_args i args x; close_open_inverse'_terms i decrs x and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) }) : Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ ND x i] == args) (decreases args) = match args with | [] -> () | (a, q) :: args -> close_open_inverse' i a x; close_open_inverse'_args i args x and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) }) : Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ ND x i ] == b) (decreases b) = let bndr = inspect_binder b in close_open_inverse' i bndr.sort x; close_open_inverse'_terms i bndr.attrs x; pack_inspect_binder b and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts) (decreases ts) = match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x and close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x and close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br) (decreases br) = let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x and close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x and close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m) (decreases m) = let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x) let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) }) : Lemma (close_term (open_term e x) x == e) = open_term_spec e x; close_term_spec (open_term e x) x; close_open_inverse' 0 e x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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.Stubs.Reflection.V2.Data.pattern -> x: FStar.Stubs.Reflection.V2.Data.var -> i: Prims.nat -> FStar.Pervasives.Lemma (requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_pattern p))) (ensures FStar.Reflection.Typing.subst_pattern p [FStar.Reflection.Typing.ND x i] == p) (decreases p)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[ "close_with_not_free_var", "close_match_returns_with_not_free_var", "close_branches_with_not_free_var", "close_branch_with_not_free_var", "close_pattern_with_not_free_var", "close_patterns_with_not_free_var", "close_terms_with_not_free_var", "close_binder_with_not_free_var", "close_comp_with_not_free_var", "close_args_with_not_free_var" ]
[ "FStar.Stubs.Reflection.V2.Data.pattern", "FStar.Stubs.Reflection.V2.Data.var", "Prims.nat", "FStar.Stubs.Reflection.V2.Data.vconst", "FStar.Stubs.Reflection.Types.fv", "FStar.Pervasives.Native.option", "FStar.Stubs.Reflection.V2.Data.universes", "Prims.list", "FStar.Pervasives.Native.tuple2", "Prims.bool", "FStar.Reflection.Typing.close_patterns_with_not_free_var", "FStar.Sealed.sealed", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.V2.Data.ppname_t", "FStar.Reflection.Typing.close_with_not_free_var", "Prims.unit", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "FStar.Reflection.Typing.freevars_pattern", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_pattern", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec close_pattern_with_not_free_var (p: R.pattern) (x: var) (i: nat) : Lemma (requires ~(Set.mem x (freevars_pattern p))) (ensures subst_pattern p [ND x i] == p) (decreases p) =
match p with | Pat_Constant _ -> () | Pat_Cons _ _ pats -> close_patterns_with_not_free_var pats x i | Pat_Var bv _ -> () | Pat_Dot_Term topt -> (match topt with | None -> () | Some t -> close_with_not_free_var t x i)
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.open_close_inverse'_comp
val open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c)
val open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in ()
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 346, "start_col": 0, "start_line": 131 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> c: FStar.Stubs.Reflection.Types.comp{FStar.Reflection.Typing.ln'_comp c (i - 1)} -> x: FStar.Stubs.Reflection.V2.Data.var -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_comp (FStar.Reflection.Typing.subst_comp c [FStar.Reflection.Typing.ND x i]) (FStar.Reflection.Typing.open_with_var x i) == c) (decreases c)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "open_close_inverse'", "open_close_inverse'_binder", "open_close_inverse'_terms", "open_close_inverse'_comp", "open_close_inverse'_args", "open_close_inverse'_patterns", "open_close_inverse'_pattern", "open_close_inverse'_branch", "open_close_inverse'_branches", "open_close_inverse'_match_returns" ]
[ "Prims.nat", "FStar.Stubs.Reflection.Types.comp", "Prims.b2t", "FStar.Reflection.Typing.ln'_comp", "Prims.op_Subtraction", "FStar.Stubs.Reflection.V2.Data.var", "FStar.Stubs.Reflection.V2.Builtins.inspect_comp", "FStar.Stubs.Reflection.Types.typ", "FStar.Reflection.Typing.open_close_inverse'", "FStar.Stubs.Reflection.Types.term", "Prims.unit", "FStar.Stubs.Reflection.V2.Data.universes", "FStar.Stubs.Reflection.Types.name", "Prims.list", "FStar.Stubs.Reflection.V2.Data.argv", "FStar.Reflection.Typing.open_close_inverse'_terms", "FStar.Reflection.Typing.open_close_inverse'_args", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_comp", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Reflection.Typing.open_with_var", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec open_close_inverse'_comp (i: nat) (c: comp{ln'_comp c (i - 1)}) (x: var) : Lemma (ensures subst_comp (subst_comp c [ND x i]) (open_with_var x i) == c) (decreases c) =
match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.open_close_inverse'
val open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t)
val open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in ()
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 346, "start_col": 0, "start_line": 131 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> t: FStar.Stubs.Reflection.Types.term{FStar.Reflection.Typing.ln' t (i - 1)} -> x: FStar.Stubs.Reflection.V2.Data.var -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_term (FStar.Reflection.Typing.subst_term t [FStar.Reflection.Typing.ND x i]) (FStar.Reflection.Typing.open_with_var x i) == t) (decreases t)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "open_close_inverse'", "open_close_inverse'_binder", "open_close_inverse'_terms", "open_close_inverse'_comp", "open_close_inverse'_args", "open_close_inverse'_patterns", "open_close_inverse'_pattern", "open_close_inverse'_branch", "open_close_inverse'_branches", "open_close_inverse'_match_returns" ]
[ "Prims.nat", "FStar.Stubs.Reflection.Types.term", "Prims.b2t", "FStar.Reflection.Typing.ln'", "Prims.op_Subtraction", "FStar.Stubs.Reflection.V2.Data.var", "FStar.Stubs.Reflection.V2.Builtins.inspect_ln", "FStar.Stubs.Reflection.Types.fv", "FStar.Stubs.Reflection.V2.Data.universes", "FStar.Stubs.Reflection.Types.universe", "FStar.Stubs.Reflection.V2.Data.vconst", "FStar.Stubs.Reflection.Types.bv", "FStar.Stubs.Reflection.Types.namedv", "FStar.Stubs.Reflection.V2.Data.argv", "FStar.Reflection.Typing.open_close_inverse'", "FStar.Pervasives.Native.fst", "FStar.Stubs.Reflection.V2.Data.aqualv", "Prims.unit", "FStar.Stubs.Reflection.Types.binder", "Prims.op_Addition", "FStar.Reflection.Typing.open_close_inverse'_binder", "FStar.Stubs.Reflection.Types.comp", "FStar.Reflection.Typing.open_close_inverse'_comp", "FStar.Stubs.Reflection.V2.Data.simple_binder", "Prims.bool", "Prims.list", "FStar.Reflection.Typing.open_close_inverse'_terms", "FStar.Pervasives.Native.option", "FStar.Stubs.Reflection.Types.match_returns_ascription", "FStar.Stubs.Reflection.V2.Data.branch", "FStar.Reflection.Typing.open_close_inverse'_branches", "FStar.Reflection.Typing.open_close_inverse'_match_returns", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_term", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Reflection.Typing.open_with_var", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec open_close_inverse' (i: nat) (t: term{ln' t (i - 1)}) (x: var) : Lemma (ensures subst_term (subst_term t [ND x i]) (open_with_var x i) == t) (decreases t) =
match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x)
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.close_patterns_with_not_free_var
val close_patterns_with_not_free_var (l: list (R.pattern & bool)) (x: var) (i: nat) : Lemma (requires ~(Set.mem x (freevars_patterns l))) (ensures subst_patterns l [ND x i] == l) (decreases l)
val close_patterns_with_not_free_var (l: list (R.pattern & bool)) (x: var) (i: nat) : Lemma (requires ~(Set.mem x (freevars_patterns l))) (ensures subst_patterns l [ND x i] == l) (decreases l)
let rec close_with_not_free_var (t:R.term) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars t))) (ensures subst_term t [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Var _ | Tv_BVar _ | Tv_FVar _ | Tv_UInst _ _ -> () | Tv_App hd (arg, _) -> close_with_not_free_var hd x i; close_with_not_free_var arg x i | Tv_Abs b body -> close_binder_with_not_free_var b x i; close_with_not_free_var body x (i + 1) | Tv_Arrow b c -> close_binder_with_not_free_var b x i; close_comp_with_not_free_var c x (i + 1) | Tv_Type _ -> () | Tv_Refine b t -> close_binder_with_not_free_var b x i; close_with_not_free_var t x (i + 1) | Tv_Const _ -> () | Tv_Uvar _ _ -> assert False | Tv_Let recf attrs b e1 e2 -> close_terms_with_not_free_var attrs x i; close_binder_with_not_free_var b x i; (if recf then close_with_not_free_var e1 x (i + 1) else close_with_not_free_var e1 x i); close_with_not_free_var e2 x (i + 1) | Tv_Match scrutinee ret_opt brs -> close_with_not_free_var scrutinee x i; (match ret_opt with | None -> () | Some ret -> close_match_returns_with_not_free_var ret x i); close_branches_with_not_free_var brs x i | Tv_AscribedT e t tacopt _ -> close_with_not_free_var e x i; close_with_not_free_var t x i; (match tacopt with | None -> () | Some tac -> close_with_not_free_var tac x i) | Tv_AscribedC e c tacopt _ -> close_with_not_free_var e x i; close_comp_with_not_free_var c x i; (match tacopt with | None -> () | Some tac -> close_with_not_free_var tac x i) | Tv_Unknown -> () | Tv_Unsupp -> () and close_match_returns_with_not_free_var (r:match_returns_ascription) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_match_returns r))) (ensures subst_match_returns r [ ND x i ] == r) (decreases r) = let b, (ret, as_opt, _) = r in close_binder_with_not_free_var b x i; (match ret with | Inl t -> close_with_not_free_var t x (i + 1) | Inr c -> close_comp_with_not_free_var c x (i + 1)); (match as_opt with | None -> () | Some t -> close_with_not_free_var t x (i + 1)) and close_branches_with_not_free_var (brs:list R.branch) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_branches brs))) (ensures subst_branches brs [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | hd::tl -> close_branch_with_not_free_var hd x i; close_branches_with_not_free_var tl x i and close_branch_with_not_free_var (br:R.branch) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_branch br))) (ensures subst_branch br [ ND x i ] == br) (decreases br) = let p, t = br in close_pattern_with_not_free_var p x i; close_with_not_free_var t x (binder_offset_pattern p + i) and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_pattern p))) (ensures subst_pattern p [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons _ _ pats -> close_patterns_with_not_free_var pats x i | Pat_Var bv _ -> () | Pat_Dot_Term topt -> (match topt with | None -> () | Some t -> close_with_not_free_var t x i) and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_patterns l))) (ensures subst_patterns l [ ND x i ] == l) (decreases l) = match l with | [] -> () | (p, _)::tl -> close_pattern_with_not_free_var p x i; close_patterns_with_not_free_var tl x (binder_offset_pattern p + i) and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_terms l))) (ensures subst_terms l [ ND x i ] == l) (decreases l) = match l with | [] -> () | hd::tl -> close_with_not_free_var hd x i; close_terms_with_not_free_var tl x i and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_binder b))) (ensures subst_binder b [ ND x i ] == b) (decreases b) = let {attrs; sort} = inspect_binder b in close_with_not_free_var sort x i; close_terms_with_not_free_var attrs x i and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_comp c))) (ensures subst_comp c [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_with_not_free_var t x i | C_Lemma pre post pats -> close_with_not_free_var pre x i; close_with_not_free_var post x i; close_with_not_free_var pats x i | C_Eff _ _ t args decrs -> close_with_not_free_var t x i; close_args_with_not_free_var args x i; close_terms_with_not_free_var decrs x i and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_args l))) (ensures subst_args l [ ND x i ] == l) (decreases l) = match l with | [] -> () | (t, _)::tl -> close_with_not_free_var t x i; close_args_with_not_free_var tl x i
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 39, "end_line": 747, "start_col": 0, "start_line": 570 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss) let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in () let open_close_inverse (e:R.term { ln e }) (x:var) : Lemma (open_term (close_term e x) x == e) = close_term_spec e x; open_term_spec (close_term e x) x; open_close_inverse' 0 e x let rec close_open_inverse' (i:nat) (t:term) (x:var { ~(x `Set.mem` freevars t) }) : Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Uvar _ _ -> assert false | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> () | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> close_open_inverse' i t1 x; close_open_inverse' i (fst a) x | Tv_Abs b body -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) body x | Tv_Arrow b c -> close_open_inverse'_binder i b x; close_open_inverse'_comp (i + 1) c x | Tv_Refine b f -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> close_open_inverse'_terms i attrs x; close_open_inverse'_binder i b x; close_open_inverse' (if recf then (i + 1) else i) def x; close_open_inverse' (i + 1) body x | Tv_Match scr ret brs -> close_open_inverse' i scr x; (match ret with | None -> () | Some m -> close_open_inverse'_match_returns i m x); close_open_inverse'_branches i brs x | Tv_AscribedT e t tac b -> close_open_inverse' i e x; close_open_inverse' i t x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) | Tv_AscribedC e c tac b -> close_open_inverse' i e x; close_open_inverse'_comp i c x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) and close_open_inverse'_comp (i:nat) (c:comp) (x:var{ ~(x `Set.mem` freevars_comp c) }) : Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_open_inverse' i t x | C_Lemma pre post pats -> close_open_inverse' i pre x; close_open_inverse' i post x; close_open_inverse' i pats x | C_Eff us eff_name res args decrs -> close_open_inverse' i res x; close_open_inverse'_args i args x; close_open_inverse'_terms i decrs x and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) }) : Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ ND x i] == args) (decreases args) = match args with | [] -> () | (a, q) :: args -> close_open_inverse' i a x; close_open_inverse'_args i args x and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) }) : Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ ND x i ] == b) (decreases b) = let bndr = inspect_binder b in close_open_inverse' i bndr.sort x; close_open_inverse'_terms i bndr.attrs x; pack_inspect_binder b and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts) (decreases ts) = match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x and close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x and close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br) (decreases br) = let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x and close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x and close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m) (decreases m) = let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x) let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) }) : Lemma (close_term (open_term e x) x == e) = open_term_spec e x; close_term_spec (open_term e x) x; close_open_inverse' 0 e x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
l: Prims.list (FStar.Stubs.Reflection.V2.Data.pattern * Prims.bool) -> x: FStar.Stubs.Reflection.V2.Data.var -> i: Prims.nat -> FStar.Pervasives.Lemma (requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_patterns l))) (ensures FStar.Reflection.Typing.subst_patterns l [FStar.Reflection.Typing.ND x i] == l) (decreases l)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[ "close_with_not_free_var", "close_match_returns_with_not_free_var", "close_branches_with_not_free_var", "close_branch_with_not_free_var", "close_pattern_with_not_free_var", "close_patterns_with_not_free_var", "close_terms_with_not_free_var", "close_binder_with_not_free_var", "close_comp_with_not_free_var", "close_args_with_not_free_var" ]
[ "Prims.list", "FStar.Pervasives.Native.tuple2", "FStar.Stubs.Reflection.V2.Data.pattern", "Prims.bool", "FStar.Stubs.Reflection.V2.Data.var", "Prims.nat", "FStar.Reflection.Typing.close_patterns_with_not_free_var", "Prims.op_Addition", "FStar.Reflection.Typing.binder_offset_pattern", "Prims.unit", "FStar.Reflection.Typing.close_pattern_with_not_free_var", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "FStar.Reflection.Typing.freevars_patterns", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_patterns", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec close_patterns_with_not_free_var (l: list (R.pattern & bool)) (x: var) (i: nat) : Lemma (requires ~(Set.mem x (freevars_patterns l))) (ensures subst_patterns l [ND x i] == l) (decreases l) =
match l with | [] -> () | (p, _) :: tl -> close_pattern_with_not_free_var p x i; close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.close_comp_with_not_free_var
val close_comp_with_not_free_var (c: R.comp) (x: var) (i: nat) : Lemma (requires ~(Set.mem x (freevars_comp c))) (ensures subst_comp c [ND x i] == c) (decreases c)
val close_comp_with_not_free_var (c: R.comp) (x: var) (i: nat) : Lemma (requires ~(Set.mem x (freevars_comp c))) (ensures subst_comp c [ND x i] == c) (decreases c)
let rec close_with_not_free_var (t:R.term) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars t))) (ensures subst_term t [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Var _ | Tv_BVar _ | Tv_FVar _ | Tv_UInst _ _ -> () | Tv_App hd (arg, _) -> close_with_not_free_var hd x i; close_with_not_free_var arg x i | Tv_Abs b body -> close_binder_with_not_free_var b x i; close_with_not_free_var body x (i + 1) | Tv_Arrow b c -> close_binder_with_not_free_var b x i; close_comp_with_not_free_var c x (i + 1) | Tv_Type _ -> () | Tv_Refine b t -> close_binder_with_not_free_var b x i; close_with_not_free_var t x (i + 1) | Tv_Const _ -> () | Tv_Uvar _ _ -> assert False | Tv_Let recf attrs b e1 e2 -> close_terms_with_not_free_var attrs x i; close_binder_with_not_free_var b x i; (if recf then close_with_not_free_var e1 x (i + 1) else close_with_not_free_var e1 x i); close_with_not_free_var e2 x (i + 1) | Tv_Match scrutinee ret_opt brs -> close_with_not_free_var scrutinee x i; (match ret_opt with | None -> () | Some ret -> close_match_returns_with_not_free_var ret x i); close_branches_with_not_free_var brs x i | Tv_AscribedT e t tacopt _ -> close_with_not_free_var e x i; close_with_not_free_var t x i; (match tacopt with | None -> () | Some tac -> close_with_not_free_var tac x i) | Tv_AscribedC e c tacopt _ -> close_with_not_free_var e x i; close_comp_with_not_free_var c x i; (match tacopt with | None -> () | Some tac -> close_with_not_free_var tac x i) | Tv_Unknown -> () | Tv_Unsupp -> () and close_match_returns_with_not_free_var (r:match_returns_ascription) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_match_returns r))) (ensures subst_match_returns r [ ND x i ] == r) (decreases r) = let b, (ret, as_opt, _) = r in close_binder_with_not_free_var b x i; (match ret with | Inl t -> close_with_not_free_var t x (i + 1) | Inr c -> close_comp_with_not_free_var c x (i + 1)); (match as_opt with | None -> () | Some t -> close_with_not_free_var t x (i + 1)) and close_branches_with_not_free_var (brs:list R.branch) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_branches brs))) (ensures subst_branches brs [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | hd::tl -> close_branch_with_not_free_var hd x i; close_branches_with_not_free_var tl x i and close_branch_with_not_free_var (br:R.branch) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_branch br))) (ensures subst_branch br [ ND x i ] == br) (decreases br) = let p, t = br in close_pattern_with_not_free_var p x i; close_with_not_free_var t x (binder_offset_pattern p + i) and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_pattern p))) (ensures subst_pattern p [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons _ _ pats -> close_patterns_with_not_free_var pats x i | Pat_Var bv _ -> () | Pat_Dot_Term topt -> (match topt with | None -> () | Some t -> close_with_not_free_var t x i) and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_patterns l))) (ensures subst_patterns l [ ND x i ] == l) (decreases l) = match l with | [] -> () | (p, _)::tl -> close_pattern_with_not_free_var p x i; close_patterns_with_not_free_var tl x (binder_offset_pattern p + i) and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_terms l))) (ensures subst_terms l [ ND x i ] == l) (decreases l) = match l with | [] -> () | hd::tl -> close_with_not_free_var hd x i; close_terms_with_not_free_var tl x i and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_binder b))) (ensures subst_binder b [ ND x i ] == b) (decreases b) = let {attrs; sort} = inspect_binder b in close_with_not_free_var sort x i; close_terms_with_not_free_var attrs x i and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_comp c))) (ensures subst_comp c [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_with_not_free_var t x i | C_Lemma pre post pats -> close_with_not_free_var pre x i; close_with_not_free_var post x i; close_with_not_free_var pats x i | C_Eff _ _ t args decrs -> close_with_not_free_var t x i; close_args_with_not_free_var args x i; close_terms_with_not_free_var decrs x i and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat) : Lemma (requires ~ (Set.mem x (freevars_args l))) (ensures subst_args l [ ND x i ] == l) (decreases l) = match l with | [] -> () | (t, _)::tl -> close_with_not_free_var t x i; close_args_with_not_free_var tl x i
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 39, "end_line": 747, "start_col": 0, "start_line": 570 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss) let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in () let open_close_inverse (e:R.term { ln e }) (x:var) : Lemma (open_term (close_term e x) x == e) = close_term_spec e x; open_term_spec (close_term e x) x; open_close_inverse' 0 e x let rec close_open_inverse' (i:nat) (t:term) (x:var { ~(x `Set.mem` freevars t) }) : Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Uvar _ _ -> assert false | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> () | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> close_open_inverse' i t1 x; close_open_inverse' i (fst a) x | Tv_Abs b body -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) body x | Tv_Arrow b c -> close_open_inverse'_binder i b x; close_open_inverse'_comp (i + 1) c x | Tv_Refine b f -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> close_open_inverse'_terms i attrs x; close_open_inverse'_binder i b x; close_open_inverse' (if recf then (i + 1) else i) def x; close_open_inverse' (i + 1) body x | Tv_Match scr ret brs -> close_open_inverse' i scr x; (match ret with | None -> () | Some m -> close_open_inverse'_match_returns i m x); close_open_inverse'_branches i brs x | Tv_AscribedT e t tac b -> close_open_inverse' i e x; close_open_inverse' i t x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) | Tv_AscribedC e c tac b -> close_open_inverse' i e x; close_open_inverse'_comp i c x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) and close_open_inverse'_comp (i:nat) (c:comp) (x:var{ ~(x `Set.mem` freevars_comp c) }) : Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_open_inverse' i t x | C_Lemma pre post pats -> close_open_inverse' i pre x; close_open_inverse' i post x; close_open_inverse' i pats x | C_Eff us eff_name res args decrs -> close_open_inverse' i res x; close_open_inverse'_args i args x; close_open_inverse'_terms i decrs x and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) }) : Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ ND x i] == args) (decreases args) = match args with | [] -> () | (a, q) :: args -> close_open_inverse' i a x; close_open_inverse'_args i args x and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) }) : Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ ND x i ] == b) (decreases b) = let bndr = inspect_binder b in close_open_inverse' i bndr.sort x; close_open_inverse'_terms i bndr.attrs x; pack_inspect_binder b and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts) (decreases ts) = match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x and close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x and close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br) (decreases br) = let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x and close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x and close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m) (decreases m) = let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x) let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) }) : Lemma (close_term (open_term e x) x == e) = open_term_spec e x; close_term_spec (open_term e x) x; close_open_inverse' 0 e x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
c: FStar.Stubs.Reflection.Types.comp -> x: FStar.Stubs.Reflection.V2.Data.var -> i: Prims.nat -> FStar.Pervasives.Lemma (requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_comp c))) (ensures FStar.Reflection.Typing.subst_comp c [FStar.Reflection.Typing.ND x i] == c) (decreases c)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[ "close_with_not_free_var", "close_match_returns_with_not_free_var", "close_branches_with_not_free_var", "close_branch_with_not_free_var", "close_pattern_with_not_free_var", "close_patterns_with_not_free_var", "close_terms_with_not_free_var", "close_binder_with_not_free_var", "close_comp_with_not_free_var", "close_args_with_not_free_var" ]
[ "FStar.Stubs.Reflection.Types.comp", "FStar.Stubs.Reflection.V2.Data.var", "Prims.nat", "FStar.Stubs.Reflection.V2.Builtins.inspect_comp", "FStar.Stubs.Reflection.Types.typ", "FStar.Reflection.Typing.close_with_not_free_var", "FStar.Stubs.Reflection.Types.term", "Prims.unit", "FStar.Stubs.Reflection.V2.Data.universes", "FStar.Stubs.Reflection.Types.name", "Prims.list", "FStar.Stubs.Reflection.V2.Data.argv", "FStar.Reflection.Typing.close_terms_with_not_free_var", "FStar.Reflection.Typing.close_args_with_not_free_var", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "FStar.Reflection.Typing.freevars_comp", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_comp", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec close_comp_with_not_free_var (c: R.comp) (x: var) (i: nat) : Lemma (requires ~(Set.mem x (freevars_comp c))) (ensures subst_comp c [ND x i] == c) (decreases c) =
match inspect_comp c with | C_Total t | C_GTotal t -> close_with_not_free_var t x i | C_Lemma pre post pats -> close_with_not_free_var pre x i; close_with_not_free_var post x i; close_with_not_free_var pats x i | C_Eff _ _ t args decrs -> close_with_not_free_var t x i; close_args_with_not_free_var args x i; close_terms_with_not_free_var decrs x i
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.open_close_inverse'_terms
val open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts)
val open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in ()
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 346, "start_col": 0, "start_line": 131 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> ts: Prims.list FStar.Stubs.Reflection.Types.term {FStar.Reflection.Typing.ln'_terms ts (i - 1)} -> x: FStar.Stubs.Reflection.V2.Data.var -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_terms (FStar.Reflection.Typing.subst_terms ts [FStar.Reflection.Typing.ND x i]) (FStar.Reflection.Typing.open_with_var x i) == ts) (decreases ts)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "open_close_inverse'", "open_close_inverse'_binder", "open_close_inverse'_terms", "open_close_inverse'_comp", "open_close_inverse'_args", "open_close_inverse'_patterns", "open_close_inverse'_pattern", "open_close_inverse'_branch", "open_close_inverse'_branches", "open_close_inverse'_match_returns" ]
[ "Prims.nat", "Prims.list", "FStar.Stubs.Reflection.Types.term", "Prims.b2t", "FStar.Reflection.Typing.ln'_terms", "Prims.op_Subtraction", "FStar.Stubs.Reflection.V2.Data.var", "FStar.Reflection.Typing.open_close_inverse'_terms", "Prims.unit", "FStar.Reflection.Typing.open_close_inverse'", "Prims.l_True", "Prims.squash", "Prims.eq2", "Prims.l_or", "Prims.l_imp", "Prims.uu___is_Nil", "FStar.Reflection.Typing.subst_terms", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Reflection.Typing.open_with_var", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec open_close_inverse'_terms (i: nat) (ts: list term {ln'_terms ts (i - 1)}) (x: var) : Lemma (ensures subst_terms (subst_terms ts [ND x i]) (open_with_var x i) == ts) (decreases ts) =
match ts with | [] -> () | t :: ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.close_open_inverse'_branch
val close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br)
val close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br)
let rec close_open_inverse' (i:nat) (t:term) (x:var { ~(x `Set.mem` freevars t) }) : Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Uvar _ _ -> assert false | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> () | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> close_open_inverse' i t1 x; close_open_inverse' i (fst a) x | Tv_Abs b body -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) body x | Tv_Arrow b c -> close_open_inverse'_binder i b x; close_open_inverse'_comp (i + 1) c x | Tv_Refine b f -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> close_open_inverse'_terms i attrs x; close_open_inverse'_binder i b x; close_open_inverse' (if recf then (i + 1) else i) def x; close_open_inverse' (i + 1) body x | Tv_Match scr ret brs -> close_open_inverse' i scr x; (match ret with | None -> () | Some m -> close_open_inverse'_match_returns i m x); close_open_inverse'_branches i brs x | Tv_AscribedT e t tac b -> close_open_inverse' i e x; close_open_inverse' i t x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) | Tv_AscribedC e c tac b -> close_open_inverse' i e x; close_open_inverse'_comp i c x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) and close_open_inverse'_comp (i:nat) (c:comp) (x:var{ ~(x `Set.mem` freevars_comp c) }) : Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_open_inverse' i t x | C_Lemma pre post pats -> close_open_inverse' i pre x; close_open_inverse' i post x; close_open_inverse' i pats x | C_Eff us eff_name res args decrs -> close_open_inverse' i res x; close_open_inverse'_args i args x; close_open_inverse'_terms i decrs x and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) }) : Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ ND x i] == args) (decreases args) = match args with | [] -> () | (a, q) :: args -> close_open_inverse' i a x; close_open_inverse'_args i args x and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) }) : Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ ND x i ] == b) (decreases b) = let bndr = inspect_binder b in close_open_inverse' i bndr.sort x; close_open_inverse'_terms i bndr.attrs x; pack_inspect_binder b and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts) (decreases ts) = match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x and close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x and close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br) (decreases br) = let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x and close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x and close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m) (decreases m) = let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x)
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 561, "start_col": 0, "start_line": 354 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss) let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in () let open_close_inverse (e:R.term { ln e }) (x:var) : Lemma (open_term (close_term e x) x == e) = close_term_spec e x; open_term_spec (close_term e x) x; open_close_inverse' 0 e x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> br: FStar.Stubs.Reflection.V2.Data.branch -> x: FStar.Stubs.Reflection.V2.Data.var {~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_branch br))} -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_branch (FStar.Reflection.Typing.subst_branch br (FStar.Reflection.Typing.open_with_var x i)) [FStar.Reflection.Typing.ND x i] == br) (decreases br)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "close_open_inverse'", "close_open_inverse'_comp", "close_open_inverse'_args", "close_open_inverse'_binder", "close_open_inverse'_terms", "close_open_inverse'_branches", "close_open_inverse'_branch", "close_open_inverse'_pattern", "close_open_inverse'_patterns", "close_open_inverse'_match_returns" ]
[ "Prims.nat", "FStar.Stubs.Reflection.V2.Data.branch", "FStar.Stubs.Reflection.V2.Data.var", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "FStar.Reflection.Typing.freevars_branch", "FStar.Stubs.Reflection.V2.Data.pattern", "FStar.Stubs.Reflection.Types.term", "FStar.Reflection.Typing.close_open_inverse'", "Prims.op_Addition", "FStar.Reflection.Typing.binder_offset_pattern", "Prims.unit", "FStar.Reflection.Typing.binder_offset_pattern_invariant", "FStar.Reflection.Typing.open_with_var", "FStar.Reflection.Typing.close_open_inverse'_pattern", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_branch", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec close_open_inverse'_branch (i: nat) (br: branch) (x: var{~(x `Set.mem` (freevars_branch br))}) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ND x i] == br) (decreases br) =
let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.close_open_inverse'_match_returns
val close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m)
val close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m)
let rec close_open_inverse' (i:nat) (t:term) (x:var { ~(x `Set.mem` freevars t) }) : Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Uvar _ _ -> assert false | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> () | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> close_open_inverse' i t1 x; close_open_inverse' i (fst a) x | Tv_Abs b body -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) body x | Tv_Arrow b c -> close_open_inverse'_binder i b x; close_open_inverse'_comp (i + 1) c x | Tv_Refine b f -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> close_open_inverse'_terms i attrs x; close_open_inverse'_binder i b x; close_open_inverse' (if recf then (i + 1) else i) def x; close_open_inverse' (i + 1) body x | Tv_Match scr ret brs -> close_open_inverse' i scr x; (match ret with | None -> () | Some m -> close_open_inverse'_match_returns i m x); close_open_inverse'_branches i brs x | Tv_AscribedT e t tac b -> close_open_inverse' i e x; close_open_inverse' i t x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) | Tv_AscribedC e c tac b -> close_open_inverse' i e x; close_open_inverse'_comp i c x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) and close_open_inverse'_comp (i:nat) (c:comp) (x:var{ ~(x `Set.mem` freevars_comp c) }) : Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_open_inverse' i t x | C_Lemma pre post pats -> close_open_inverse' i pre x; close_open_inverse' i post x; close_open_inverse' i pats x | C_Eff us eff_name res args decrs -> close_open_inverse' i res x; close_open_inverse'_args i args x; close_open_inverse'_terms i decrs x and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) }) : Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ ND x i] == args) (decreases args) = match args with | [] -> () | (a, q) :: args -> close_open_inverse' i a x; close_open_inverse'_args i args x and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) }) : Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ ND x i ] == b) (decreases b) = let bndr = inspect_binder b in close_open_inverse' i bndr.sort x; close_open_inverse'_terms i bndr.attrs x; pack_inspect_binder b and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts) (decreases ts) = match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x and close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x and close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br) (decreases br) = let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x and close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x and close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m) (decreases m) = let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x)
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 561, "start_col": 0, "start_line": 354 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss) let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in () let open_close_inverse (e:R.term { ln e }) (x:var) : Lemma (open_term (close_term e x) x == e) = close_term_spec e x; open_term_spec (close_term e x) x; open_close_inverse' 0 e x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> m: FStar.Stubs.Reflection.Types.match_returns_ascription -> x: FStar.Stubs.Reflection.V2.Data.var {~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_match_returns m))} -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_match_returns (FStar.Reflection.Typing.subst_match_returns m (FStar.Reflection.Typing.open_with_var x i)) [FStar.Reflection.Typing.ND x i] == m) (decreases m)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "close_open_inverse'", "close_open_inverse'_comp", "close_open_inverse'_args", "close_open_inverse'_binder", "close_open_inverse'_terms", "close_open_inverse'_branches", "close_open_inverse'_branch", "close_open_inverse'_pattern", "close_open_inverse'_patterns", "close_open_inverse'_match_returns" ]
[ "Prims.nat", "FStar.Stubs.Reflection.Types.match_returns_ascription", "FStar.Stubs.Reflection.V2.Data.var", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "FStar.Reflection.Typing.freevars_match_returns", "FStar.Stubs.Reflection.Types.binder", "FStar.Pervasives.either", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.Types.comp", "FStar.Pervasives.Native.option", "Prims.bool", "FStar.Reflection.Typing.close_open_inverse'", "Prims.op_Addition", "Prims.unit", "FStar.Reflection.Typing.close_open_inverse'_comp", "FStar.Reflection.Typing.close_open_inverse'_binder", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_match_returns", "FStar.Reflection.Typing.open_with_var", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec close_open_inverse'_match_returns (i: nat) (m: match_returns_ascription) (x: var{~(x `Set.mem` (freevars_match_returns m))}) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ND x i] == m) (decreases m) =
let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x)
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.open_close_inverse'_pattern
val open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p)
val open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in ()
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 346, "start_col": 0, "start_line": 131 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> p: FStar.Stubs.Reflection.V2.Data.pattern{FStar.Reflection.Typing.ln'_pattern p (i - 1)} -> x: FStar.Stubs.Reflection.V2.Data.var -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_pattern (FStar.Reflection.Typing.subst_pattern p [FStar.Reflection.Typing.ND x i]) (FStar.Reflection.Typing.open_with_var x i) == p) (decreases p)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "open_close_inverse'", "open_close_inverse'_binder", "open_close_inverse'_terms", "open_close_inverse'_comp", "open_close_inverse'_args", "open_close_inverse'_patterns", "open_close_inverse'_pattern", "open_close_inverse'_branch", "open_close_inverse'_branches", "open_close_inverse'_match_returns" ]
[ "Prims.nat", "FStar.Stubs.Reflection.V2.Data.pattern", "Prims.b2t", "FStar.Reflection.Typing.ln'_pattern", "Prims.op_Subtraction", "FStar.Stubs.Reflection.V2.Data.var", "FStar.Stubs.Reflection.V2.Data.vconst", "FStar.Stubs.Reflection.Types.fv", "FStar.Pervasives.Native.option", "FStar.Stubs.Reflection.V2.Data.universes", "Prims.list", "FStar.Pervasives.Native.tuple2", "Prims.bool", "FStar.Reflection.Typing.open_close_inverse'_patterns", "FStar.Sealed.sealed", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.V2.Data.ppname_t", "FStar.Reflection.Typing.open_close_inverse'", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_pattern", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Reflection.Typing.open_with_var", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec open_close_inverse'_pattern (i: nat) (p: pattern{ln'_pattern p (i - 1)}) (x: var) : Lemma (ensures subst_pattern (subst_pattern p [ND x i]) (open_with_var x i) == p) (decreases p) =
match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.close_open_inverse'_patterns
val close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps)
val close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps)
let rec close_open_inverse' (i:nat) (t:term) (x:var { ~(x `Set.mem` freevars t) }) : Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Uvar _ _ -> assert false | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> () | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> close_open_inverse' i t1 x; close_open_inverse' i (fst a) x | Tv_Abs b body -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) body x | Tv_Arrow b c -> close_open_inverse'_binder i b x; close_open_inverse'_comp (i + 1) c x | Tv_Refine b f -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> close_open_inverse'_terms i attrs x; close_open_inverse'_binder i b x; close_open_inverse' (if recf then (i + 1) else i) def x; close_open_inverse' (i + 1) body x | Tv_Match scr ret brs -> close_open_inverse' i scr x; (match ret with | None -> () | Some m -> close_open_inverse'_match_returns i m x); close_open_inverse'_branches i brs x | Tv_AscribedT e t tac b -> close_open_inverse' i e x; close_open_inverse' i t x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) | Tv_AscribedC e c tac b -> close_open_inverse' i e x; close_open_inverse'_comp i c x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) and close_open_inverse'_comp (i:nat) (c:comp) (x:var{ ~(x `Set.mem` freevars_comp c) }) : Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_open_inverse' i t x | C_Lemma pre post pats -> close_open_inverse' i pre x; close_open_inverse' i post x; close_open_inverse' i pats x | C_Eff us eff_name res args decrs -> close_open_inverse' i res x; close_open_inverse'_args i args x; close_open_inverse'_terms i decrs x and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) }) : Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ ND x i] == args) (decreases args) = match args with | [] -> () | (a, q) :: args -> close_open_inverse' i a x; close_open_inverse'_args i args x and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) }) : Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ ND x i ] == b) (decreases b) = let bndr = inspect_binder b in close_open_inverse' i bndr.sort x; close_open_inverse'_terms i bndr.attrs x; pack_inspect_binder b and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts) (decreases ts) = match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x and close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x and close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br) (decreases br) = let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x and close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x and close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m) (decreases m) = let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x)
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 561, "start_col": 0, "start_line": 354 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss) let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in () let open_close_inverse (e:R.term { ln e }) (x:var) : Lemma (open_term (close_term e x) x == e) = close_term_spec e x; open_term_spec (close_term e x) x; open_close_inverse' 0 e x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> ps: Prims.list (FStar.Stubs.Reflection.V2.Data.pattern * Prims.bool) -> x: FStar.Stubs.Reflection.V2.Data.var {~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_patterns ps))} -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_patterns (FStar.Reflection.Typing.subst_patterns ps (FStar.Reflection.Typing.open_with_var x i)) [FStar.Reflection.Typing.ND x i] == ps) (decreases ps)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "close_open_inverse'", "close_open_inverse'_comp", "close_open_inverse'_args", "close_open_inverse'_binder", "close_open_inverse'_terms", "close_open_inverse'_branches", "close_open_inverse'_branch", "close_open_inverse'_pattern", "close_open_inverse'_patterns", "close_open_inverse'_match_returns" ]
[ "Prims.nat", "Prims.list", "FStar.Pervasives.Native.tuple2", "FStar.Stubs.Reflection.V2.Data.pattern", "Prims.bool", "FStar.Stubs.Reflection.V2.Data.var", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "FStar.Reflection.Typing.freevars_patterns", "FStar.Reflection.Typing.close_open_inverse'_patterns", "Prims.op_Addition", "Prims.unit", "FStar.Reflection.Typing.binder_offset_pattern_invariant", "FStar.Reflection.Typing.open_with_var", "FStar.Reflection.Typing.binder_offset_pattern", "FStar.Reflection.Typing.close_open_inverse'_pattern", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_patterns", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec close_open_inverse'_patterns (i: nat) (ps: list (pattern & bool)) (x: var{~(x `Set.mem` (freevars_patterns ps))}) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ND x i] == ps) (decreases ps) =
match ps with | [] -> () | (p, b) :: ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.close_open_inverse'_terms
val close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts)
val close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts)
let rec close_open_inverse' (i:nat) (t:term) (x:var { ~(x `Set.mem` freevars t) }) : Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Uvar _ _ -> assert false | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> () | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> close_open_inverse' i t1 x; close_open_inverse' i (fst a) x | Tv_Abs b body -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) body x | Tv_Arrow b c -> close_open_inverse'_binder i b x; close_open_inverse'_comp (i + 1) c x | Tv_Refine b f -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> close_open_inverse'_terms i attrs x; close_open_inverse'_binder i b x; close_open_inverse' (if recf then (i + 1) else i) def x; close_open_inverse' (i + 1) body x | Tv_Match scr ret brs -> close_open_inverse' i scr x; (match ret with | None -> () | Some m -> close_open_inverse'_match_returns i m x); close_open_inverse'_branches i brs x | Tv_AscribedT e t tac b -> close_open_inverse' i e x; close_open_inverse' i t x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) | Tv_AscribedC e c tac b -> close_open_inverse' i e x; close_open_inverse'_comp i c x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) and close_open_inverse'_comp (i:nat) (c:comp) (x:var{ ~(x `Set.mem` freevars_comp c) }) : Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_open_inverse' i t x | C_Lemma pre post pats -> close_open_inverse' i pre x; close_open_inverse' i post x; close_open_inverse' i pats x | C_Eff us eff_name res args decrs -> close_open_inverse' i res x; close_open_inverse'_args i args x; close_open_inverse'_terms i decrs x and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) }) : Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ ND x i] == args) (decreases args) = match args with | [] -> () | (a, q) :: args -> close_open_inverse' i a x; close_open_inverse'_args i args x and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) }) : Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ ND x i ] == b) (decreases b) = let bndr = inspect_binder b in close_open_inverse' i bndr.sort x; close_open_inverse'_terms i bndr.attrs x; pack_inspect_binder b and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts) (decreases ts) = match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x and close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x and close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br) (decreases br) = let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x and close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x and close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m) (decreases m) = let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x)
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 561, "start_col": 0, "start_line": 354 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss) let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in () let open_close_inverse (e:R.term { ln e }) (x:var) : Lemma (open_term (close_term e x) x == e) = close_term_spec e x; open_term_spec (close_term e x) x; open_close_inverse' 0 e x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> ts: Prims.list FStar.Stubs.Reflection.Types.term -> x: FStar.Stubs.Reflection.V2.Data.var {~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_terms ts))} -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_terms (FStar.Reflection.Typing.subst_terms ts (FStar.Reflection.Typing.open_with_var x i)) [FStar.Reflection.Typing.ND x i] == ts) (decreases ts)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "close_open_inverse'", "close_open_inverse'_comp", "close_open_inverse'_args", "close_open_inverse'_binder", "close_open_inverse'_terms", "close_open_inverse'_branches", "close_open_inverse'_branch", "close_open_inverse'_pattern", "close_open_inverse'_patterns", "close_open_inverse'_match_returns" ]
[ "Prims.nat", "Prims.list", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.V2.Data.var", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "FStar.Reflection.Typing.freevars_terms", "FStar.Reflection.Typing.close_open_inverse'_terms", "Prims.unit", "FStar.Reflection.Typing.close_open_inverse'", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_terms", "FStar.Reflection.Typing.open_with_var", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec close_open_inverse'_terms (i: nat) (ts: list term) (x: var{~(x `Set.mem` (freevars_terms ts))}) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ND x i] == ts) (decreases ts) =
match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x
false
LowParse.Low.List.fst
LowParse.Low.List.valid_exact_list_nil
val valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures (valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] ))
val valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures (valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] ))
let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 47, "end_line": 31, "start_col": 0, "start_line": 15 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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) (ensures LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl pos pos /\ LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl pos pos == [])
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.contents_exact_eq", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "Prims.unit", "LowParse.Low.Base.Spec.valid_exact_equiv", "LowParse.Spec.List.parse_list_eq", "LowParse.Low.Base.Spec.bytes_of_slice_from_to", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "LowParse.Slice.__proj__Mkslice__item__len", "LowParse.Slice.live_slice", "Prims.squash", "LowParse.Low.Base.Spec.valid_exact", "Prims.eq2", "LowParse.Low.Base.Spec.contents_exact", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures (valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) =
parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.open_close_inverse'_binder
val open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b)
val open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in ()
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 346, "start_col": 0, "start_line": 131 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> b: FStar.Stubs.Reflection.Types.binder{FStar.Reflection.Typing.ln'_binder b (i - 1)} -> x: FStar.Stubs.Reflection.V2.Data.var -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_binder (FStar.Reflection.Typing.subst_binder b [FStar.Reflection.Typing.ND x i]) (FStar.Reflection.Typing.open_with_var x i) == b) (decreases b)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "open_close_inverse'", "open_close_inverse'_binder", "open_close_inverse'_terms", "open_close_inverse'_comp", "open_close_inverse'_args", "open_close_inverse'_patterns", "open_close_inverse'_pattern", "open_close_inverse'_branch", "open_close_inverse'_branches", "open_close_inverse'_match_returns" ]
[ "Prims.nat", "FStar.Stubs.Reflection.Types.binder", "Prims.b2t", "FStar.Reflection.Typing.ln'_binder", "Prims.op_Subtraction", "FStar.Stubs.Reflection.V2.Data.var", "FStar.Stubs.Reflection.Types.typ", "FStar.Stubs.Reflection.V2.Data.aqualv", "Prims.list", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.V2.Data.ppname_t", "Prims._assert", "Prims.eq2", "FStar.Stubs.Reflection.V2.Builtins.pack_binder", "FStar.Stubs.Reflection.V2.Data.Mkbinder_view", "Prims.unit", "FStar.Reflection.Typing.pack_inspect_binder", "FStar.Reflection.Typing.subst_terms", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Reflection.Typing.open_with_var", "FStar.Reflection.Typing.open_close_inverse'_terms", "FStar.Reflection.Typing.open_close_inverse'", "FStar.Stubs.Reflection.V2.Data.binder_view", "Prims.precedes", "FStar.Stubs.Reflection.V2.Builtins.inspect_binder", "Prims.l_True", "Prims.squash", "Prims.l_or", "Prims.l_imp", "FStar.Stubs.Reflection.V2.Data.binder_is_simple", "FStar.Reflection.Typing.subst_binder", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec open_close_inverse'_binder (i: nat) (b: binder{ln'_binder b (i - 1)}) (x: var) : Lemma (ensures subst_binder (subst_binder b [ND x i]) (open_with_var x i) == b) (decreases b) =
let bndr = inspect_binder b in let { ppname = ppname ; qual = q ; attrs = attrs ; sort = sort } = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ND x i]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder ({ ppname = ppname; qual = q; attrs = attrs; sort = sort }) == b)
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.open_close_inverse'_match_returns
val open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m)
val open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in ()
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 346, "start_col": 0, "start_line": 131 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> m: FStar.Stubs.Reflection.Types.match_returns_ascription {FStar.Reflection.Typing.ln'_match_returns m (i - 1)} -> x: FStar.Stubs.Reflection.V2.Data.var -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_match_returns (FStar.Reflection.Typing.subst_match_returns m [FStar.Reflection.Typing.ND x i]) (FStar.Reflection.Typing.open_with_var x i) == m) (decreases m)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "open_close_inverse'", "open_close_inverse'_binder", "open_close_inverse'_terms", "open_close_inverse'_comp", "open_close_inverse'_args", "open_close_inverse'_patterns", "open_close_inverse'_pattern", "open_close_inverse'_branch", "open_close_inverse'_branches", "open_close_inverse'_match_returns" ]
[ "Prims.nat", "FStar.Stubs.Reflection.Types.match_returns_ascription", "Prims.b2t", "FStar.Reflection.Typing.ln'_match_returns", "Prims.op_Subtraction", "FStar.Stubs.Reflection.V2.Data.var", "FStar.Stubs.Reflection.Types.binder", "FStar.Pervasives.either", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.Types.comp", "FStar.Pervasives.Native.option", "Prims.bool", "Prims.unit", "FStar.Reflection.Typing.open_close_inverse'", "Prims.op_Addition", "FStar.Reflection.Typing.open_close_inverse'_comp", "FStar.Reflection.Typing.open_close_inverse'_binder", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_match_returns", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Reflection.Typing.open_with_var", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec open_close_inverse'_match_returns (i: nat) (m: match_returns_ascription{ln'_match_returns m (i - 1)}) (x: var) : Lemma (ensures subst_match_returns (subst_match_returns m [ND x i]) (open_with_var x i) == m) (decreases m) =
let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in ()
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.close_open_inverse'_branches
val close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs)
val close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs)
let rec close_open_inverse' (i:nat) (t:term) (x:var { ~(x `Set.mem` freevars t) }) : Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Uvar _ _ -> assert false | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> () | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> close_open_inverse' i t1 x; close_open_inverse' i (fst a) x | Tv_Abs b body -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) body x | Tv_Arrow b c -> close_open_inverse'_binder i b x; close_open_inverse'_comp (i + 1) c x | Tv_Refine b f -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> close_open_inverse'_terms i attrs x; close_open_inverse'_binder i b x; close_open_inverse' (if recf then (i + 1) else i) def x; close_open_inverse' (i + 1) body x | Tv_Match scr ret brs -> close_open_inverse' i scr x; (match ret with | None -> () | Some m -> close_open_inverse'_match_returns i m x); close_open_inverse'_branches i brs x | Tv_AscribedT e t tac b -> close_open_inverse' i e x; close_open_inverse' i t x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) | Tv_AscribedC e c tac b -> close_open_inverse' i e x; close_open_inverse'_comp i c x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) and close_open_inverse'_comp (i:nat) (c:comp) (x:var{ ~(x `Set.mem` freevars_comp c) }) : Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_open_inverse' i t x | C_Lemma pre post pats -> close_open_inverse' i pre x; close_open_inverse' i post x; close_open_inverse' i pats x | C_Eff us eff_name res args decrs -> close_open_inverse' i res x; close_open_inverse'_args i args x; close_open_inverse'_terms i decrs x and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) }) : Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ ND x i] == args) (decreases args) = match args with | [] -> () | (a, q) :: args -> close_open_inverse' i a x; close_open_inverse'_args i args x and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) }) : Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ ND x i ] == b) (decreases b) = let bndr = inspect_binder b in close_open_inverse' i bndr.sort x; close_open_inverse'_terms i bndr.attrs x; pack_inspect_binder b and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts) (decreases ts) = match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x and close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x and close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br) (decreases br) = let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x and close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x and close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m) (decreases m) = let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x)
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 561, "start_col": 0, "start_line": 354 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss) let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in () let open_close_inverse (e:R.term { ln e }) (x:var) : Lemma (open_term (close_term e x) x == e) = close_term_spec e x; open_term_spec (close_term e x) x; open_close_inverse' 0 e x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> brs: Prims.list FStar.Stubs.Reflection.V2.Data.branch -> x: FStar.Stubs.Reflection.V2.Data.var {~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_branches brs))} -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_branches (FStar.Reflection.Typing.subst_branches brs (FStar.Reflection.Typing.open_with_var x i)) [FStar.Reflection.Typing.ND x i] == brs) (decreases brs)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "close_open_inverse'", "close_open_inverse'_comp", "close_open_inverse'_args", "close_open_inverse'_binder", "close_open_inverse'_terms", "close_open_inverse'_branches", "close_open_inverse'_branch", "close_open_inverse'_pattern", "close_open_inverse'_patterns", "close_open_inverse'_match_returns" ]
[ "Prims.nat", "Prims.list", "FStar.Stubs.Reflection.V2.Data.branch", "FStar.Stubs.Reflection.V2.Data.var", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "FStar.Reflection.Typing.freevars_branches", "FStar.Reflection.Typing.close_open_inverse'_branches", "Prims.unit", "FStar.Reflection.Typing.close_open_inverse'_branch", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_branches", "FStar.Reflection.Typing.open_with_var", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec close_open_inverse'_branches (i: nat) (brs: list branch) (x: var{~(x `Set.mem` (freevars_branches brs))}) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ND x i] == brs) (decreases brs) =
match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x
false
LowParse.Low.List.fst
LowParse.Low.List.valid_list_intro_nil
val valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures (valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == []))
val valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures (valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == []))
let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 37, "end_line": 49, "start_col": 0, "start_line": 33 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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) (ensures LowParse.Low.Base.Spec.valid (LowParse.Spec.List.parse_list p) h sl pos /\ LowParse.Low.Base.Spec.contents (LowParse.Spec.List.parse_list p) h sl pos == [])
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.contents_eq", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "Prims.unit", "LowParse.Low.Base.Spec.valid_equiv", "LowParse.Spec.List.parse_list_eq", "LowParse.Slice.bytes_of_slice_from", "Prims.l_and", "Prims.eq2", "FStar.UInt.uint_t", "FStar.UInt32.n", "FStar.UInt32.v", "LowParse.Slice.__proj__Mkslice__item__len", "LowParse.Slice.live_slice", "Prims.squash", "LowParse.Low.Base.Spec.valid", "LowParse.Low.Base.Spec.contents", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures (valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [])) =
parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.open_close_inverse'_branch
val open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br)
val open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in ()
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 346, "start_col": 0, "start_line": 131 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> br: FStar.Stubs.Reflection.V2.Data.branch{FStar.Reflection.Typing.ln'_branch br (i - 1)} -> x: FStar.Stubs.Reflection.V2.Data.var -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_branch (FStar.Reflection.Typing.subst_branch br [FStar.Reflection.Typing.ND x i]) (FStar.Reflection.Typing.open_with_var x i) == br) (decreases br)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "open_close_inverse'", "open_close_inverse'_binder", "open_close_inverse'_terms", "open_close_inverse'_comp", "open_close_inverse'_args", "open_close_inverse'_patterns", "open_close_inverse'_pattern", "open_close_inverse'_branch", "open_close_inverse'_branches", "open_close_inverse'_match_returns" ]
[ "Prims.nat", "FStar.Stubs.Reflection.V2.Data.branch", "Prims.b2t", "FStar.Reflection.Typing.ln'_branch", "Prims.op_Subtraction", "FStar.Stubs.Reflection.V2.Data.var", "FStar.Stubs.Reflection.V2.Data.pattern", "FStar.Stubs.Reflection.Types.term", "FStar.Reflection.Typing.open_close_inverse'", "Prims.op_Addition", "Prims.unit", "FStar.Reflection.Typing.open_close_inverse'_pattern", "FStar.Reflection.Typing.binder_offset_pattern_invariant", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Reflection.Typing.binder_offset_pattern", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_branch", "FStar.Reflection.Typing.open_with_var", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec open_close_inverse'_branch (i: nat) (br: branch{ln'_branch br (i - 1)}) (x: var) : Lemma (ensures subst_branch (subst_branch br [ND x i]) (open_with_var x i) == br) (decreases br) =
let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ND x i]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.open_close_inverse'_branches
val open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs)
val open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in ()
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 346, "start_col": 0, "start_line": 131 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> brs: Prims.list FStar.Stubs.Reflection.V2.Data.branch {FStar.Reflection.Typing.ln'_branches brs (i - 1)} -> x: FStar.Stubs.Reflection.V2.Data.var -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_branches (FStar.Reflection.Typing.subst_branches brs [FStar.Reflection.Typing.ND x i]) (FStar.Reflection.Typing.open_with_var x i) == brs) (decreases brs)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "open_close_inverse'", "open_close_inverse'_binder", "open_close_inverse'_terms", "open_close_inverse'_comp", "open_close_inverse'_args", "open_close_inverse'_patterns", "open_close_inverse'_pattern", "open_close_inverse'_branch", "open_close_inverse'_branches", "open_close_inverse'_match_returns" ]
[ "Prims.nat", "Prims.list", "FStar.Stubs.Reflection.V2.Data.branch", "Prims.b2t", "FStar.Reflection.Typing.ln'_branches", "Prims.op_Subtraction", "FStar.Stubs.Reflection.V2.Data.var", "FStar.Reflection.Typing.open_close_inverse'_branches", "Prims.unit", "FStar.Reflection.Typing.open_close_inverse'_branch", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_branches", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Reflection.Typing.open_with_var", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec open_close_inverse'_branches (i: nat) (brs: list branch {ln'_branches brs (i - 1)}) (x: var) : Lemma (ensures subst_branches (subst_branches brs [ND x i]) (open_with_var x i) == brs) (decreases brs) =
match brs with | [] -> () | br :: brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x
false
Hacl.Impl.Ed25519.PointNegate.fst
Hacl.Impl.Ed25519.PointNegate.point_negate
val point_negate: p:F51.point -> out:F51.point -> Stack unit (requires fun h -> live h out /\ live h p /\ disjoint out p /\ F51.point_inv_t h p) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ (let (x1, y1, z1, t1) = F51.point_eval h0 p in F51.point_inv_t h1 out /\ F51.point_eval h1 out == SC.((-x1) % prime, y1, z1, (-t1) % prime)))
val point_negate: p:F51.point -> out:F51.point -> Stack unit (requires fun h -> live h out /\ live h p /\ disjoint out p /\ F51.point_inv_t h p) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ (let (x1, y1, z1, t1) = F51.point_eval h0 p in F51.point_inv_t h1 out /\ F51.point_eval h1 out == SC.((-x1) % prime, y1, z1, (-t1) % prime)))
let point_negate p out = push_frame (); let zero = create 5ul (u64 0) in make_zero zero; let x = getx p in let y = gety p in let z = getz p in let t = gett p in let x1 = getx out in let y1 = gety out in let z1 = getz out in let t1 = gett out in fdifference x1 zero x; reduce_513 x1; copy y1 y; copy z1 z; fdifference t1 zero t; reduce_513 t1; pop_frame ()
{ "file_name": "code/ed25519/Hacl.Impl.Ed25519.PointNegate.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 46, "start_col": 0, "start_line": 26 }
module Hacl.Impl.Ed25519.PointNegate module ST = FStar.HyperStack.ST open FStar.HyperStack.All open Lib.IntTypes open Lib.Buffer open Hacl.Bignum25519 module F51 = Hacl.Impl.Ed25519.Field51 module SC = Spec.Curve25519 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val point_negate: p:F51.point -> out:F51.point -> Stack unit (requires fun h -> live h out /\ live h p /\ disjoint out p /\ F51.point_inv_t h p) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ (let (x1, y1, z1, t1) = F51.point_eval h0 p in F51.point_inv_t h1 out /\ F51.point_eval h1 out == SC.((-x1) % prime, y1, z1, (-t1) % prime)))
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Ed25519.Field51.fst.checked", "Hacl.Bignum25519.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Ed25519.PointNegate.fst" }
[ { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "SC" }, { "abbrev": true, "full_module": "Hacl.Impl.Ed25519.Field51", "short_module": "F51" }, { "abbrev": false, "full_module": "Hacl.Bignum25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Ed25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Ed25519", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Hacl.Impl.Ed25519.Field51.point -> out: Hacl.Impl.Ed25519.Field51.point -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Hacl.Impl.Ed25519.Field51.point", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Bignum25519.reduce_513", "Hacl.Bignum25519.fdifference", "Lib.Buffer.copy", "Lib.Buffer.MUT", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Hacl.Bignum25519.felem", "Hacl.Bignum25519.gett", "Hacl.Bignum25519.getz", "Hacl.Bignum25519.gety", "Hacl.Bignum25519.getx", "Hacl.Bignum25519.make_zero", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Lib.Buffer.create", "Lib.IntTypes.u64", "Lib.Buffer.lbuffer", "FStar.HyperStack.ST.push_frame" ]
[]
false
true
false
false
false
let point_negate p out =
push_frame (); let zero = create 5ul (u64 0) in make_zero zero; let x = getx p in let y = gety p in let z = getz p in let t = gett p in let x1 = getx out in let y1 = gety out in let z1 = getz out in let t1 = gett out in fdifference x1 zero x; reduce_513 x1; copy y1 y; copy z1 z; fdifference t1 zero t; reduce_513 t1; pop_frame ()
false
LowParse.Low.List.fst
LowParse.Low.List.valid_exact_list_cons
val valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos')) (ensures (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos') )
val valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos')) (ensures (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos') )
let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos'
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 49, "end_line": 86, "start_col": 0, "start_line": 51 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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 Mkparser_kind'?.parser_kind_subkind k == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\ Mkparser_kind'?.parser_kind_low k > 0 /\ LowParse.Low.Base.Spec.valid p h sl pos /\ LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl (LowParse.Low.Base.Spec.get_valid_pos 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.Low.Base.Spec.valid p h sl pos /\ LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl (LowParse.Low.Base.Spec.get_valid_pos p h sl pos) pos' /\ LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl pos pos' /\ LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl pos pos' == LowParse.Low.Base.Spec.contents p h sl pos :: LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl (LowParse.Low.Base.Spec.get_valid_pos p h sl pos) pos')
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.contents_exact_eq", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "Prims.unit", "LowParse.Low.Base.Spec.valid_exact_equiv", "Prims._assert", "LowParse.Spec.Base.injective_postcond", "LowParse.Spec.Base.no_lookahead_on", "LowParse.Spec.Base.parser_kind_prop_equiv", "LowParse.Bytes.bytes", "LowParse.Slice.bytes_of_slice_from", "LowParse.Low.Base.Spec.valid_facts", "LowParse.Low.Base.Spec.get_valid_pos", "LowParse.Spec.List.parse_list_eq'", "LowParse.Low.Base.Spec.bytes_of_slice_from_to", "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.Low.Base.Spec.valid", "LowParse.Low.Base.Spec.valid_exact", "Prims.squash", "LowParse.Low.Base.Spec.contents_exact", "Prims.Cons", "LowParse.Low.Base.Spec.contents", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos')) (ensures (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos') ) =
let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos'
false
LowParse.Low.List.fst
LowParse.Low.List.valid_list_intro_cons
val valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos))) (ensures (valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos)))
val valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos))) (ensures (valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos)))
let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 38, "end_line": 113, "start_col": 0, "start_line": 88 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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.Low.Base.Spec.valid p h sl pos /\ LowParse.Low.Base.Spec.valid (LowParse.Spec.List.parse_list p) h sl (LowParse.Low.Base.Spec.get_valid_pos p h sl pos)) (ensures LowParse.Low.Base.Spec.valid p h sl pos /\ LowParse.Low.Base.Spec.valid (LowParse.Spec.List.parse_list p) h sl (LowParse.Low.Base.Spec.get_valid_pos p h sl pos) /\ LowParse.Low.Base.Spec.valid (LowParse.Spec.List.parse_list p) h sl pos /\ LowParse.Low.Base.Spec.contents (LowParse.Spec.List.parse_list p) h sl pos == LowParse.Low.Base.Spec.contents p h sl pos :: LowParse.Low.Base.Spec.contents (LowParse.Spec.List.parse_list p) h sl (LowParse.Low.Base.Spec.get_valid_pos p h sl pos))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.valid_facts", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "Prims.unit", "LowParse.Low.Base.Spec.get_valid_pos", "LowParse.Spec.List.parse_list_eq", "LowParse.Bytes.bytes", "LowParse.Slice.bytes_of_slice_from", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "FStar.UInt32.v", "LowParse.Slice.__proj__Mkslice__item__len", "LowParse.Low.Base.Spec.valid", "Prims.squash", "Prims.eq2", "LowParse.Low.Base.Spec.contents", "Prims.Cons", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos))) (ensures (valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos))) =
let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1
false
FStar.Reflection.Typing.fst
FStar.Reflection.Typing.close_open_inverse'_pattern
val close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p)
val close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p)
let rec close_open_inverse' (i:nat) (t:term) (x:var { ~(x `Set.mem` freevars t) }) : Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ ND x i ] == t) (decreases t) = match inspect_ln t with | Tv_Uvar _ _ -> assert false | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> () | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> close_open_inverse' i t1 x; close_open_inverse' i (fst a) x | Tv_Abs b body -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) body x | Tv_Arrow b c -> close_open_inverse'_binder i b x; close_open_inverse'_comp (i + 1) c x | Tv_Refine b f -> close_open_inverse'_binder i b x; close_open_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> close_open_inverse'_terms i attrs x; close_open_inverse'_binder i b x; close_open_inverse' (if recf then (i + 1) else i) def x; close_open_inverse' (i + 1) body x | Tv_Match scr ret brs -> close_open_inverse' i scr x; (match ret with | None -> () | Some m -> close_open_inverse'_match_returns i m x); close_open_inverse'_branches i brs x | Tv_AscribedT e t tac b -> close_open_inverse' i e x; close_open_inverse' i t x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) | Tv_AscribedC e c tac b -> close_open_inverse' i e x; close_open_inverse'_comp i c x; (match tac with | None -> () | Some t -> close_open_inverse' i t x) and close_open_inverse'_comp (i:nat) (c:comp) (x:var{ ~(x `Set.mem` freevars_comp c) }) : Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ ND x i ] == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> close_open_inverse' i t x | C_Lemma pre post pats -> close_open_inverse' i pre x; close_open_inverse' i post x; close_open_inverse' i pats x | C_Eff us eff_name res args decrs -> close_open_inverse' i res x; close_open_inverse'_args i args x; close_open_inverse'_terms i decrs x and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) }) : Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ ND x i] == args) (decreases args) = match args with | [] -> () | (a, q) :: args -> close_open_inverse' i a x; close_open_inverse'_args i args x and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) }) : Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ ND x i ] == b) (decreases b) = let bndr = inspect_binder b in close_open_inverse' i bndr.sort x; close_open_inverse'_terms i bndr.attrs x; pack_inspect_binder b and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) }) : Lemma (ensures subst_terms (subst_terms ts (open_with_var x i)) [ ND x i ] == ts) (decreases ts) = match ts with | [] -> () | hd :: tl -> close_open_inverse' i hd x; close_open_inverse'_terms i tl x and close_open_inverse'_branches (i:nat) (brs:list branch) (x:var{ ~(x `Set.mem` freevars_branches brs) }) : Lemma (ensures subst_branches (subst_branches brs (open_with_var x i)) [ ND x i ] == brs) (decreases brs) = match brs with | [] -> () | b :: brs -> close_open_inverse'_branch i b x; close_open_inverse'_branches i brs x and close_open_inverse'_branch (i:nat) (br:branch) (x:var{ ~(x `Set.mem` freevars_branch br) }) : Lemma (ensures subst_branch (subst_branch br (open_with_var x i)) [ ND x i ] == br) (decreases br) = let p, t = br in close_open_inverse'_pattern i p x; binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse' (i + binder_offset_pattern p) t x and close_open_inverse'_pattern (i:nat) (p:pattern) (x:var{ ~(x `Set.mem` freevars_pattern p) }) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ ND x i ] == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x and close_open_inverse'_patterns (i:nat) (ps:list (pattern & bool)) (x:var {~ (x `Set.mem` freevars_patterns ps) }) : Lemma (ensures subst_patterns (subst_patterns ps (open_with_var x i)) [ ND x i ] == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> close_open_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p (open_with_var x i); close_open_inverse'_patterns (i + n) ps' x and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription) (x:var{ ~(x `Set.mem` freevars_match_returns m) }) : Lemma (ensures subst_match_returns (subst_match_returns m (open_with_var x i)) [ ND x i ] == m) (decreases m) = let b, (ret, as_, eq) = m in close_open_inverse'_binder i b x; (match ret with | Inl t -> close_open_inverse' (i + 1) t x | Inr c -> close_open_inverse'_comp (i + 1) c x); (match as_ with | None -> () | Some t -> close_open_inverse' (i + 1) t x)
{ "file_name": "ulib/experimental/FStar.Reflection.Typing.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 561, "start_col": 0, "start_line": 354 }
(* Copyright 2008-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 FStar.Reflection.Typing (** This module defines a typing judgment for (parts of) the total fragment of F*. We are using it in the meta DSL framework as an official specification for the F* type system. We expect it to grow to cover more of the F* language. IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE. *) open FStar.List.Tot open FStar.Reflection.V2 module R = FStar.Reflection.V2 module T = FStar.Tactics.V2 module RTB = FStar.Reflection.Typing.Builtins let inspect_pack = R.inspect_pack_inv let pack_inspect = R.pack_inspect_inv let inspect_pack_namedv = R.inspect_pack_namedv let pack_inspect_namedv = R.pack_inspect_namedv let inspect_pack_bv = R.inspect_pack_bv let pack_inspect_bv = R.pack_inspect_bv let inspect_pack_binder = R.inspect_pack_binder let pack_inspect_binder = R.pack_inspect_binder let inspect_pack_comp = R.inspect_pack_comp_inv let pack_inspect_comp = R.pack_inspect_comp_inv let inspect_pack_fv = R.inspect_pack_fv let pack_inspect_fv = R.pack_inspect_fv let inspect_pack_universe = R.inspect_pack_universe let pack_inspect_universe = R.pack_inspect_universe let lookup_bvar (e:env) (x:int) : option term = magic () let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe) : option R.term = magic () let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit () let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit () let subst_ctx_uvar_and_subst _ _ = magic () let open_with (t:term) (v:term) = RTB.open_with t v let open_with_spec (t v:term) = admit () let open_term (t:term) (v:var) = RTB.open_term t v let open_term_spec (t:term) (v:var) = admit () let close_term (t:term) (v:var) = RTB.close_term t v let close_term_spec (t:term) (v:var) = admit () let rename (t:term) (x y:var)= RTB.rename t x y let rename_spec (t:term) (x y:var) = admit () let bv_index_of_make_bv (n:nat) = () let namedv_uniq_of_make_namedv (n:nat) = () let bindings_ok_for_pat bnds pat = magic () let bindings_ok_pat_constant c = admit () let subtyping_token_renaming (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic () let subtyping_token_weakening (g:env) (bs0:bindings) (bs1:bindings) (x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) }) (t:term) (t0 t1:term) (d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic () let well_typed_terms_are_ln _ _ _ _ = admit () let type_correctness _ _ _ _ = admit () let rec binder_offset_pattern_invariant (p:pattern) (ss:subst) : Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) (decreases p) = match p with | Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss | _ -> () and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst) : Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) (decreases p) = match p with | [] -> () | (hd, _)::tl -> binder_offset_pattern_invariant hd ss; let n = binder_offset_pattern hd in binder_offset_patterns_invariant tl (shift_subst_n n ss) let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var) : Lemma (ensures subst_term (subst_term t [ ND x i ]) (open_with_var x i) == t) (decreases t) = match inspect_ln t with | Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown | Tv_BVar _ -> () | Tv_Var _ -> () | Tv_App t1 a -> open_close_inverse' i t1 x; open_close_inverse' i (fst a) x | Tv_Abs b body -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) body x | Tv_Arrow b c -> open_close_inverse'_binder i b x; open_close_inverse'_comp (i + 1) c x | Tv_Refine b f -> open_close_inverse'_binder i b x; open_close_inverse' (i + 1) f x | Tv_Let recf attrs b def body -> open_close_inverse'_terms i attrs x; open_close_inverse'_binder i b x; (if recf then open_close_inverse' (i + 1) def x else open_close_inverse' i def x); open_close_inverse' (i + 1) body x | Tv_Match scr ret brs -> open_close_inverse' i scr x; (match ret with | None -> () | Some m -> open_close_inverse'_match_returns i m x); open_close_inverse'_branches i brs x | Tv_AscribedT e t tac b -> open_close_inverse' i e x; open_close_inverse' i t x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) | Tv_AscribedC e c tac b -> open_close_inverse' i e x; open_close_inverse'_comp i c x; (match tac with | None -> () | Some tac -> open_close_inverse' i tac x) and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var) : Lemma (ensures subst_binder (subst_binder b [ ND x i ]) (open_with_var x i) == b) (decreases b) = let bndr = inspect_binder b in let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in open_close_inverse' i sort x; open_close_inverse'_terms i attrs x; assert (subst_terms (subst_terms attrs [ ND x i ]) (open_with_var x i) == attrs); pack_inspect_binder b; assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b) and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var) : Lemma (ensures subst_terms (subst_terms ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | t::ts -> open_close_inverse' i t x; open_close_inverse'_terms i ts x and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var) : Lemma (ensures subst_comp (subst_comp c [ ND x i ]) (open_with_var x i) == c) (decreases c) = match inspect_comp c with | C_Total t | C_GTotal t -> open_close_inverse' i t x | C_Lemma pre post pats -> open_close_inverse' i pre x; open_close_inverse' i post x; open_close_inverse' i pats x | C_Eff us eff_name res args decrs -> open_close_inverse' i res x; open_close_inverse'_args i args x; open_close_inverse'_terms i decrs x and open_close_inverse'_args (i:nat) (ts:list argv { ln'_args ts (i - 1) }) (x:var) : Lemma (ensures subst_args (subst_args ts [ ND x i ]) (open_with_var x i) == ts) (decreases ts) = match ts with | [] -> () | (t,q)::ts -> open_close_inverse' i t x; open_close_inverse'_args i ts x and open_close_inverse'_patterns (i:nat) (ps:list (pattern & bool) { ln'_patterns ps (i - 1) }) (x:var) : Lemma (ensures subst_patterns (subst_patterns ps [ ND x i ]) (open_with_var x i) == ps) (decreases ps) = match ps with | [] -> () | (p, b)::ps' -> open_close_inverse'_pattern i p x; let n = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_patterns (i + n) ps' x and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var) : Lemma (ensures subst_pattern (subst_pattern p [ ND x i ]) (open_with_var x i) == p) (decreases p) = match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> open_close_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> open_close_inverse' i t x and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var) : Lemma (ensures subst_branch (subst_branch br [ ND x i ]) (open_with_var x i) == br) (decreases br) = let p, t = br in let j = binder_offset_pattern p in binder_offset_pattern_invariant p [ ND x i ]; open_close_inverse'_pattern i p x; open_close_inverse' (i + j) t x and open_close_inverse'_branches (i:nat) (brs:list branch { ln'_branches brs (i - 1) }) (x:var) : Lemma (ensures subst_branches (subst_branches brs [ ND x i ]) (open_with_var x i) == brs) (decreases brs) = match brs with | [] -> () | br::brs -> open_close_inverse'_branch i br x; open_close_inverse'_branches i brs x and open_close_inverse'_match_returns (i:nat) (m:match_returns_ascription { ln'_match_returns m (i - 1) }) (x:var) : Lemma (ensures subst_match_returns (subst_match_returns m [ ND x i ]) (open_with_var x i) == m) (decreases m) = let b, (ret, as_, eq) = m in open_close_inverse'_binder i b x; let ret = match ret with | Inl t -> open_close_inverse' (i + 1) t x | Inr c -> open_close_inverse'_comp (i + 1) c x in let as_ = match as_ with | None -> () | Some t -> open_close_inverse' (i + 1) t x in () let open_close_inverse (e:R.term { ln e }) (x:var) : Lemma (open_term (close_term e x) x == e) = close_term_spec e x; open_term_spec (close_term e x) x; open_close_inverse' 0 e x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.Builtins.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "FStar.Reflection.Typing.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing.Builtins", "short_module": "RTB" }, { "abbrev": true, "full_module": "FStar.Stubs.Reflection.V2.Data", "short_module": "RD" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection", "short_module": null }, { "abbrev": 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
i: Prims.nat -> p: FStar.Stubs.Reflection.V2.Data.pattern -> x: FStar.Stubs.Reflection.V2.Data.var {~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_pattern p))} -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_pattern (FStar.Reflection.Typing.subst_pattern p (FStar.Reflection.Typing.open_with_var x i)) [FStar.Reflection.Typing.ND x i] == p) (decreases p)
FStar.Pervasives.Lemma
[ "", "lemma" ]
[ "close_open_inverse'", "close_open_inverse'_comp", "close_open_inverse'_args", "close_open_inverse'_binder", "close_open_inverse'_terms", "close_open_inverse'_branches", "close_open_inverse'_branch", "close_open_inverse'_pattern", "close_open_inverse'_patterns", "close_open_inverse'_match_returns" ]
[ "Prims.nat", "FStar.Stubs.Reflection.V2.Data.pattern", "FStar.Stubs.Reflection.V2.Data.var", "Prims.l_not", "Prims.b2t", "FStar.Set.mem", "FStar.Reflection.Typing.freevars_pattern", "FStar.Stubs.Reflection.V2.Data.vconst", "FStar.Stubs.Reflection.Types.fv", "FStar.Pervasives.Native.option", "FStar.Stubs.Reflection.V2.Data.universes", "Prims.list", "FStar.Pervasives.Native.tuple2", "Prims.bool", "FStar.Reflection.Typing.close_open_inverse'_patterns", "FStar.Sealed.sealed", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.V2.Data.ppname_t", "FStar.Reflection.Typing.close_open_inverse'", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Typing.subst_pattern", "FStar.Reflection.Typing.open_with_var", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec close_open_inverse'_pattern (i: nat) (p: pattern) (x: var{~(x `Set.mem` (freevars_pattern p))}) : Lemma (ensures subst_pattern (subst_pattern p (open_with_var x i)) [ND x i] == p) (decreases p) =
match p with | Pat_Constant _ -> () | Pat_Cons fv us pats -> close_open_inverse'_patterns i pats x | Pat_Var bv _ -> () | Pat_Dot_Term topt -> match topt with | None -> () | Some t -> close_open_inverse' i t x
false
LowParse.Low.List.fst
LowParse.Low.List.valid_list_valid_exact_list
val valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos')) (decreases (U32.v pos' - U32.v pos))
val valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos')) (decreases (U32.v pos' - U32.v pos))
let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid_list p h sl pos pos' )) (ensures ( valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos' ; if pos = pos' then valid_exact_list_nil p h sl pos else begin let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos' end
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 5, "end_line": 165, "start_col": 0, "start_line": 139 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1 let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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 LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl pos pos' /\ LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl pos pos' == LowParse.Low.Base.Spec.contents_list p h sl pos pos') (decreases FStar.UInt32.v pos' - FStar.UInt32.v pos)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt32.t", "Prims.op_Equality", "LowParse.Low.List.valid_exact_list_nil", "Prims.bool", "LowParse.Low.List.valid_exact_list_cons", "Prims.unit", "LowParse.Low.List.valid_list_valid_exact_list", "LowParse.Low.Base.Spec.get_valid_pos", "LowParse.Low.Base.Spec.contents_list_eq", "LowParse.Low.Base.Spec.valid_list_equiv", "LowParse.Low.Base.Spec.valid_list", "Prims.squash", "Prims.l_and", "LowParse.Low.Base.Spec.valid_exact", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "Prims.eq2", "LowParse.Low.Base.Spec.contents_exact", "LowParse.Low.Base.Spec.contents_list", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "recursion" ]
false
false
true
false
false
let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (valid_list p h sl pos pos')) (ensures (valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos')) (decreases (U32.v pos' - U32.v pos)) =
valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos'; if pos = pos' then valid_exact_list_nil p h sl pos else let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos'
false
LowParse.Low.List.fst
LowParse.Low.List.valid_list_elim_cons
val valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos)) (ensures (valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos)))
val valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos)) (ensures (valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos)))
let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 38, "end_line": 137, "start_col": 0, "start_line": 115 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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.Low.Base.Spec.valid (LowParse.Spec.List.parse_list p) h sl pos) (ensures LowParse.Low.Base.Spec.valid p h sl pos /\ LowParse.Low.Base.Spec.valid (LowParse.Spec.List.parse_list p) h sl (LowParse.Low.Base.Spec.get_valid_pos p h sl pos))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.valid_facts", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "LowParse.Low.Base.Spec.get_valid_pos", "Prims.unit", "LowParse.Spec.List.parse_list_eq", "LowParse.Bytes.bytes", "LowParse.Slice.bytes_of_slice_from", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "FStar.UInt32.v", "LowParse.Slice.__proj__Mkslice__item__len", "LowParse.Low.Base.Spec.valid", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos: U32.t) : Lemma (requires (U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos)) (ensures (valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos))) =
let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1
false
LowParse.Low.List.fst
LowParse.Low.List.valid_exact_list_valid_list
val valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos')) (ensures (valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos')) (decreases (U32.v pos' - U32.v pos))
val valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos')) (ensures (valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos')) (decreases (U32.v pos' - U32.v pos))
let rec valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; if pos = pos' then valid_exact_list_nil p h sl pos else begin valid_exact_list_cons_recip p h sl pos pos'; let pos1 = get_valid_pos p h sl pos in valid_exact_list_valid_list p h sl pos1 pos' end; contents_list_eq p h sl pos pos'
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 34, "end_line": 233, "start_col": 0, "start_line": 204 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1 let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1 let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid_list p h sl pos pos' )) (ensures ( valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos' ; if pos = pos' then valid_exact_list_nil p h sl pos else begin let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos' end let valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos' ))) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq p sq; valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq sq0); assert (injective_postcond p sq sq0); let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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 Mkparser_kind'?.parser_kind_subkind k == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\ Mkparser_kind'?.parser_kind_low k > 0 /\ LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl pos pos') (ensures LowParse.Low.Base.Spec.valid_list p h sl pos pos' /\ LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl pos pos' == LowParse.Low.Base.Spec.contents_list p h sl pos pos') (decreases FStar.UInt32.v pos' - FStar.UInt32.v pos)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.contents_list_eq", "Prims.unit", "Prims.op_Equality", "LowParse.Low.List.valid_exact_list_nil", "Prims.bool", "LowParse.Low.List.valid_exact_list_valid_list", "LowParse.Low.Base.Spec.get_valid_pos", "LowParse.Low.List.valid_exact_list_cons_recip", "LowParse.Low.Base.Spec.valid_list_equiv", "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.Low.Base.Spec.valid_exact", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "Prims.squash", "LowParse.Low.Base.Spec.valid_list", "LowParse.Low.Base.Spec.contents_exact", "LowParse.Low.Base.Spec.contents_list", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "recursion" ]
false
false
true
false
false
let rec valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos')) (ensures (valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos')) (decreases (U32.v pos' - U32.v pos)) =
valid_list_equiv p h sl pos pos'; if pos = pos' then valid_exact_list_nil p h sl pos else (valid_exact_list_cons_recip p h sl pos pos'; let pos1 = get_valid_pos p h sl pos in valid_exact_list_valid_list p h sl pos1 pos'); contents_list_eq p h sl pos pos'
false
LowParse.Low.List.fst
LowParse.Low.List.validate_list_inv
val validate_list_inv (#k: parser_kind) (#t: Type) (p: parser k t) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) (h: HS.mem) (stop: bool) : GTot Type0
val validate_list_inv (#k: parser_kind) (#t: Type) (p: parser k t) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) (h: HS.mem) (stop: bool) : GTot Type0
let validate_list_inv (#k: parser_kind) (#t: Type) (p: parser k t) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) (h: HS.mem) (stop: bool) : GTot Type0 = let h0 = G.reveal g0 in let h1 = G.reveal g1 in B.disjoint sl.base bpos /\ k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos0 <= U32.v sl.len /\ live_slice h0 sl /\ B.live h1 bpos /\ B.modifies B.loc_none h0 h1 /\ B.modifies (B.loc_buffer bpos) h1 h /\ ( let pos1 = Seq.index (B.as_seq h bpos) 0 in if is_error pos1 then stop == true /\ (~ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len)) else U64.v pos0 <= U64.v pos1 /\ U64.v pos1 <= U32.v sl.len /\ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len <==> valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos1) sl.len) /\ (stop == true ==> U64.v pos1 == U32.v sl.len) )
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 3, "end_line": 301, "start_col": 0, "start_line": 268 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1 let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1 let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid_list p h sl pos pos' )) (ensures ( valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos' ; if pos = pos' then valid_exact_list_nil p h sl pos else begin let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos' end let valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos' ))) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq p sq; valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq sq0); assert (injective_postcond p sq sq0); let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let rec valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; if pos = pos' then valid_exact_list_nil p h sl pos else begin valid_exact_list_cons_recip p h sl pos pos'; let pos1 = get_valid_pos p h sl pos in valid_exact_list_valid_list p h sl pos1 pos' end; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let rec valid_exact_list_append (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos1 pos2 pos3 : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos1 pos2 /\ valid_exact (parse_list p) h sl pos2 pos3 )) (ensures ( valid_exact (parse_list p) h sl pos1 pos3 /\ contents_exact (parse_list p) h sl pos1 pos3 == contents_exact (parse_list p) h sl pos1 pos2 `L.append` contents_exact (parse_list p) h sl pos2 pos3 )) (decreases (U32.v pos2 - U32.v pos1)) = if pos1 = pos2 then valid_exact_list_nil p h sl pos1 else begin valid_exact_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_exact_list_append p h sl pos15 pos2 pos3; valid_exact_list_cons p h sl pos1 pos3 end
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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 -> g0: FStar.Ghost.erased FStar.Monotonic.HyperStack.mem -> g1: FStar.Ghost.erased FStar.Monotonic.HyperStack.mem -> sl: LowParse.Slice.slice rrel rel -> pos0: LowParse.Low.ErrorCode.pos_t -> bpos: LowStar.Buffer.pointer FStar.UInt64.t -> h: FStar.Monotonic.HyperStack.mem -> stop: Prims.bool -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Ghost.erased", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "LowParse.Low.ErrorCode.pos_t", "LowStar.Buffer.pointer", "FStar.UInt64.t", "Prims.bool", "Prims.l_and", "LowStar.Monotonic.Buffer.disjoint", "LowParse.Slice.buffer_srel_of_srel", "LowStar.Buffer.trivial_preorder", "LowParse.Slice.__proj__Mkslice__item__base", "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", "Prims.op_LessThanOrEqual", "FStar.UInt64.v", "FStar.UInt32.v", "LowParse.Slice.__proj__Mkslice__item__len", "LowParse.Slice.live_slice", "LowStar.Monotonic.Buffer.live", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_none", "LowStar.Monotonic.Buffer.loc_buffer", "LowParse.Low.ErrorCode.is_error", "Prims.l_not", "LowParse.Low.Base.Spec.valid_exact", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "LowParse.Low.ErrorCode.uint64_to_uint32", "Prims.l_iff", "Prims.l_imp", "Prims.int", "Prims.l_or", "FStar.UInt.size", "FStar.UInt32.n", "FStar.UInt64.n", "Prims.logical", "FStar.Seq.Base.index", "LowStar.Monotonic.Buffer.as_seq", "FStar.Ghost.reveal" ]
[]
false
false
false
false
true
let validate_list_inv (#k: parser_kind) (#t: Type) (p: parser k t) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) (h: HS.mem) (stop: bool) : GTot Type0 =
let h0 = G.reveal g0 in let h1 = G.reveal g1 in B.disjoint sl.base bpos /\ k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos0 <= U32.v sl.len /\ live_slice h0 sl /\ B.live h1 bpos /\ B.modifies B.loc_none h0 h1 /\ B.modifies (B.loc_buffer bpos) h1 h /\ (let pos1 = Seq.index (B.as_seq h bpos) 0 in if is_error pos1 then stop == true /\ (~(valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len)) else U64.v pos0 <= U64.v pos1 /\ U64.v pos1 <= U32.v sl.len /\ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len <==> valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos1) sl.len) /\ (stop == true ==> U64.v pos1 == U32.v sl.len))
false
LowParse.Low.List.fst
LowParse.Low.List.valid_exact_list_append
val valid_exact_list_append (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos1 pos2 pos3: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos1 pos2 /\ valid_exact (parse_list p) h sl pos2 pos3)) (ensures (valid_exact (parse_list p) h sl pos1 pos3 /\ contents_exact (parse_list p) h sl pos1 pos3 == (contents_exact (parse_list p) h sl pos1 pos2) `L.append` (contents_exact (parse_list p) h sl pos2 pos3))) (decreases (U32.v pos2 - U32.v pos1))
val valid_exact_list_append (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos1 pos2 pos3: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos1 pos2 /\ valid_exact (parse_list p) h sl pos2 pos3)) (ensures (valid_exact (parse_list p) h sl pos1 pos3 /\ contents_exact (parse_list p) h sl pos1 pos3 == (contents_exact (parse_list p) h sl pos1 pos2) `L.append` (contents_exact (parse_list p) h sl pos2 pos3))) (decreases (U32.v pos2 - U32.v pos1))
let rec valid_exact_list_append (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos1 pos2 pos3 : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos1 pos2 /\ valid_exact (parse_list p) h sl pos2 pos3 )) (ensures ( valid_exact (parse_list p) h sl pos1 pos3 /\ contents_exact (parse_list p) h sl pos1 pos3 == contents_exact (parse_list p) h sl pos1 pos2 `L.append` contents_exact (parse_list p) h sl pos2 pos3 )) (decreases (U32.v pos2 - U32.v pos1)) = if pos1 = pos2 then valid_exact_list_nil p h sl pos1 else begin valid_exact_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_exact_list_append p h sl pos15 pos2 pos3; valid_exact_list_cons p h sl pos1 pos3 end
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 5, "end_line": 265, "start_col": 0, "start_line": 237 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1 let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1 let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid_list p h sl pos pos' )) (ensures ( valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos' ; if pos = pos' then valid_exact_list_nil p h sl pos else begin let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos' end let valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos' ))) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq p sq; valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq sq0); assert (injective_postcond p sq sq0); let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let rec valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; if pos = pos' then valid_exact_list_nil p h sl pos else begin valid_exact_list_cons_recip p h sl pos pos'; let pos1 = get_valid_pos p h sl pos in valid_exact_list_valid_list p h sl pos1 pos' end; contents_list_eq p h sl pos pos' module L = FStar.List.Tot
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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 Mkparser_kind'?.parser_kind_subkind k == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\ Mkparser_kind'?.parser_kind_low k > 0 /\ LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl pos1 pos2 /\ LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl pos2 pos3) (ensures LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl pos1 pos3 /\ LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl pos1 pos3 == LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl pos1 pos2 @ LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl pos2 pos3) (decreases FStar.UInt32.v pos2 - FStar.UInt32.v pos1)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt32.t", "Prims.op_Equality", "LowParse.Low.List.valid_exact_list_nil", "Prims.bool", "LowParse.Low.List.valid_exact_list_cons", "Prims.unit", "LowParse.Low.List.valid_exact_list_append", "LowParse.Low.Base.Spec.get_valid_pos", "LowParse.Low.List.valid_exact_list_cons_recip", "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.Low.Base.Spec.valid_exact", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "Prims.squash", "LowParse.Low.Base.Spec.contents_exact", "FStar.List.Tot.Base.append", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "recursion" ]
false
false
true
false
false
let rec valid_exact_list_append (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos1 pos2 pos3: U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos1 pos2 /\ valid_exact (parse_list p) h sl pos2 pos3)) (ensures (valid_exact (parse_list p) h sl pos1 pos3 /\ contents_exact (parse_list p) h sl pos1 pos3 == (contents_exact (parse_list p) h sl pos1 pos2) `L.append` (contents_exact (parse_list p) h sl pos2 pos3))) (decreases (U32.v pos2 - U32.v pos1)) =
if pos1 = pos2 then valid_exact_list_nil p h sl pos1 else (valid_exact_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_exact_list_append p h sl pos15 pos2 pos3; valid_exact_list_cons p h sl pos1 pos3)
false
EverCrypt.HMAC.fst
EverCrypt.HMAC.super_hack
val super_hack : _: Prims.unit -> FStar.Tactics.Effect.Tac (Prims.list FStar.Stubs.Reflection.Types.sigelt)
let super_hack () = let open FStar.Tactics in let hash_256 = [ "EverCrypt"; "Hash"; "Incremental"; "hash_256"] in let hash_256 = FStar.Tactics.pack_fv hash_256 in let hash_256 = pack (Tv_FVar hash_256) in let fv = pack_fv (cur_module () `FStar.List.Tot.append` [ "hash_256" ]) in let t: term = pack Tv_Unknown in let se = pack_sigelt (Sg_Let false [ pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = t; lb_def = hash_256 }) ]) in [ se ]
{ "file_name": "providers/evercrypt/fst/EverCrypt.HMAC.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 21, "start_col": 0, "start_line": 13 }
(* Agile HMAC *) module EverCrypt.HMAC open Hacl.HMAC // EverCrypt.Hash.Incremental.hash_256 is marked as private, so it is // inaccessible from here. Furthermore, the EverCrypt.Hash.Incremental module // does not have an interface, meaning that we can't even friend it! Writing an // interface for EverCrypt.Hash.Incremental is possible, but doesn't make much // sense: instantiations of the functor offer, by construction, an abstract // interface. Fortunately, we can use tactics to stealthily gain access to a
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Streaming.SHA2.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "Hacl.HMAC.fsti.checked", "Hacl.Hash.SHA2.fsti.checked", "Hacl.Hash.SHA1.fsti.checked", "Hacl.Hash.Blake2s_32.fsti.checked", "Hacl.Hash.Blake2b_32.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.Incremental.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.HMAC.fst" }
[ { "abbrev": false, "full_module": "Hacl.HMAC", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.HMAC", "short_module": null }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": 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
_: Prims.unit -> FStar.Tactics.Effect.Tac (Prims.list FStar.Stubs.Reflection.Types.sigelt)
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.Cons", "FStar.Stubs.Reflection.Types.sigelt", "Prims.Nil", "FStar.Stubs.Reflection.V1.Builtins.pack_sigelt", "FStar.Stubs.Reflection.V1.Data.Sg_Let", "FStar.Stubs.Reflection.Types.letbinding", "FStar.Stubs.Reflection.V1.Builtins.pack_lb", "FStar.Stubs.Reflection.V1.Data.Mklb_view", "FStar.Stubs.Reflection.V1.Data.univ_name", "Prims.list", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Tactics.V1.Builtins.pack", "FStar.Stubs.Reflection.V1.Data.Tv_Unknown", "FStar.Stubs.Reflection.Types.fv", "FStar.Stubs.Reflection.V1.Builtins.pack_fv", "FStar.Stubs.Reflection.Types.name", "FStar.List.Tot.Base.append", "Prims.string", "FStar.Tactics.V1.Derived.cur_module", "FStar.Stubs.Reflection.V1.Data.Tv_FVar" ]
[]
false
true
false
false
false
let super_hack () =
let open FStar.Tactics in let hash_256 = ["EverCrypt"; "Hash"; "Incremental"; "hash_256"] in let hash_256 = FStar.Tactics.pack_fv hash_256 in let hash_256 = pack (Tv_FVar hash_256) in let fv = pack_fv ((cur_module ()) `FStar.List.Tot.append` ["hash_256"]) in let t:term = pack Tv_Unknown in let se = pack_sigelt (Sg_Let false [pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = t; lb_def = hash_256 })]) in [se]
false
LowParse.Low.List.fst
LowParse.Low.List.validate_list
val validate_list (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (u: squash (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0)) : Tot (validator (parse_list p))
val validate_list (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (u: squash (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0)) : Tot (validator (parse_list p))
let validate_list (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (u: squash ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 )) : Tot (validator (parse_list p)) = fun (#rrel #rel: _) (sl: slice rrel rel) pos -> let h = HST.get () in valid_valid_exact_consumes_all (parse_list p) h sl (uint64_to_uint32 pos); validate_list' v sl pos
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 25, "end_line": 387, "start_col": 0, "start_line": 371 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1 let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1 let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid_list p h sl pos pos' )) (ensures ( valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos' ; if pos = pos' then valid_exact_list_nil p h sl pos else begin let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos' end let valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos' ))) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq p sq; valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq sq0); assert (injective_postcond p sq sq0); let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let rec valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; if pos = pos' then valid_exact_list_nil p h sl pos else begin valid_exact_list_cons_recip p h sl pos pos'; let pos1 = get_valid_pos p h sl pos in valid_exact_list_valid_list p h sl pos1 pos' end; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let rec valid_exact_list_append (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos1 pos2 pos3 : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos1 pos2 /\ valid_exact (parse_list p) h sl pos2 pos3 )) (ensures ( valid_exact (parse_list p) h sl pos1 pos3 /\ contents_exact (parse_list p) h sl pos1 pos3 == contents_exact (parse_list p) h sl pos1 pos2 `L.append` contents_exact (parse_list p) h sl pos2 pos3 )) (decreases (U32.v pos2 - U32.v pos1)) = if pos1 = pos2 then valid_exact_list_nil p h sl pos1 else begin valid_exact_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_exact_list_append p h sl pos15 pos2 pos3; valid_exact_list_cons p h sl pos1 pos3 end let validate_list_inv (#k: parser_kind) (#t: Type) (p: parser k t) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) (h: HS.mem) (stop: bool) : GTot Type0 = let h0 = G.reveal g0 in let h1 = G.reveal g1 in B.disjoint sl.base bpos /\ k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos0 <= U32.v sl.len /\ live_slice h0 sl /\ B.live h1 bpos /\ B.modifies B.loc_none h0 h1 /\ B.modifies (B.loc_buffer bpos) h1 h /\ ( let pos1 = Seq.index (B.as_seq h bpos) 0 in if is_error pos1 then stop == true /\ (~ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len)) else U64.v pos0 <= U64.v pos1 /\ U64.v pos1 <= U32.v sl.len /\ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len <==> valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos1) sl.len) /\ (stop == true ==> U64.v pos1 == U32.v sl.len) ) inline_for_extraction let validate_list_body (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) : HST.Stack bool (requires (fun h -> validate_list_inv p g0 g1 sl pos0 bpos h false)) (ensures (fun h res h' -> validate_list_inv p g0 g1 sl pos0 bpos h false /\ validate_list_inv p g0 g1 sl pos0 bpos h' res )) = let pos1 = B.index bpos 0ul in assert (U64.v pos1 <= U32.v sl.len); if pos1 = Cast.uint32_to_uint64 sl.len then true else begin Classical.move_requires (valid_exact_list_cons p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; Classical.move_requires (valid_exact_list_cons_recip p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; let pos1 = v sl pos1 in B.upd bpos 0ul pos1; is_error pos1 end inline_for_extraction let validate_list' (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (#rrel #rel: _) (sl: slice rrel rel) (pos: pos_t) : HST.Stack U64.t (requires (fun h -> k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos <= U32.v sl.len /\ live_slice h sl )) (ensures (fun h res h' -> B.modifies B.loc_none h h' /\ (* we could return a boolean, but we would like to return the last validation error code if it fails. (alas, we cannot capture that fact in the spec.) *) (is_success res <==> valid_exact (parse_list p) h sl (uint64_to_uint32 pos) sl.len) /\ (is_success res ==> U64.v res == U32.v sl.len) )) = let h0 = HST.get () in let g0 = G.hide h0 in HST.push_frame (); let h02 = HST.get () in B.fresh_frame_modifies h0 h02; let bpos = B.alloca pos 1ul in let h1 = HST.get () in let g1 = G.hide h1 in C.Loops.do_while (validate_list_inv p g0 g1 sl pos bpos) (fun _ -> validate_list_body v g0 g1 sl pos bpos); valid_exact_list_nil p h0 sl sl.len; let posf = B.index bpos 0ul in HST.pop_frame (); posf
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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
v: LowParse.Low.Base.validator p -> u282: Prims.squash (Mkparser_kind'?.parser_kind_subkind k == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\ Mkparser_kind'?.parser_kind_low k > 0) -> LowParse.Low.Base.validator (LowParse.Spec.List.parse_list p)
Prims.Tot
[ "total" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Low.Base.validator", "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.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt64.t", "LowParse.Low.List.validate_list'", "Prims.unit", "LowParse.Low.Base.Spec.valid_valid_exact_consumes_all", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "LowParse.Low.ErrorCode.uint64_to_uint32", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get" ]
[]
false
false
false
false
false
let validate_list (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (u: squash (k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0)) : Tot (validator (parse_list p)) =
fun (#rrel: _) (#rel: _) (sl: slice rrel rel) pos -> let h = HST.get () in valid_valid_exact_consumes_all (parse_list p) h sl (uint64_to_uint32 pos); validate_list' v sl pos
false
LowParse.Low.List.fst
LowParse.Low.List.validate_list'
val validate_list' (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (#rrel #rel: _) (sl: slice rrel rel) (pos: pos_t) : HST.Stack U64.t (requires (fun h -> k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures (fun h res h' -> B.modifies B.loc_none h h' /\ (is_success res <==> valid_exact (parse_list p) h sl (uint64_to_uint32 pos) sl.len) /\ (is_success res ==> U64.v res == U32.v sl.len)))
val validate_list' (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (#rrel #rel: _) (sl: slice rrel rel) (pos: pos_t) : HST.Stack U64.t (requires (fun h -> k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures (fun h res h' -> B.modifies B.loc_none h h' /\ (is_success res <==> valid_exact (parse_list p) h sl (uint64_to_uint32 pos) sl.len) /\ (is_success res ==> U64.v res == U32.v sl.len)))
let validate_list' (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (#rrel #rel: _) (sl: slice rrel rel) (pos: pos_t) : HST.Stack U64.t (requires (fun h -> k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos <= U32.v sl.len /\ live_slice h sl )) (ensures (fun h res h' -> B.modifies B.loc_none h h' /\ (* we could return a boolean, but we would like to return the last validation error code if it fails. (alas, we cannot capture that fact in the spec.) *) (is_success res <==> valid_exact (parse_list p) h sl (uint64_to_uint32 pos) sl.len) /\ (is_success res ==> U64.v res == U32.v sl.len) )) = let h0 = HST.get () in let g0 = G.hide h0 in HST.push_frame (); let h02 = HST.get () in B.fresh_frame_modifies h0 h02; let bpos = B.alloca pos 1ul in let h1 = HST.get () in let g1 = G.hide h1 in C.Loops.do_while (validate_list_inv p g0 g1 sl pos bpos) (fun _ -> validate_list_body v g0 g1 sl pos bpos); valid_exact_list_nil p h0 sl sl.len; let posf = B.index bpos 0ul in HST.pop_frame (); posf
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 6, "end_line": 368, "start_col": 0, "start_line": 333 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1 let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1 let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid_list p h sl pos pos' )) (ensures ( valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos' ; if pos = pos' then valid_exact_list_nil p h sl pos else begin let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos' end let valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos' ))) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq p sq; valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq sq0); assert (injective_postcond p sq sq0); let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let rec valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; if pos = pos' then valid_exact_list_nil p h sl pos else begin valid_exact_list_cons_recip p h sl pos pos'; let pos1 = get_valid_pos p h sl pos in valid_exact_list_valid_list p h sl pos1 pos' end; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let rec valid_exact_list_append (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos1 pos2 pos3 : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos1 pos2 /\ valid_exact (parse_list p) h sl pos2 pos3 )) (ensures ( valid_exact (parse_list p) h sl pos1 pos3 /\ contents_exact (parse_list p) h sl pos1 pos3 == contents_exact (parse_list p) h sl pos1 pos2 `L.append` contents_exact (parse_list p) h sl pos2 pos3 )) (decreases (U32.v pos2 - U32.v pos1)) = if pos1 = pos2 then valid_exact_list_nil p h sl pos1 else begin valid_exact_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_exact_list_append p h sl pos15 pos2 pos3; valid_exact_list_cons p h sl pos1 pos3 end let validate_list_inv (#k: parser_kind) (#t: Type) (p: parser k t) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) (h: HS.mem) (stop: bool) : GTot Type0 = let h0 = G.reveal g0 in let h1 = G.reveal g1 in B.disjoint sl.base bpos /\ k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos0 <= U32.v sl.len /\ live_slice h0 sl /\ B.live h1 bpos /\ B.modifies B.loc_none h0 h1 /\ B.modifies (B.loc_buffer bpos) h1 h /\ ( let pos1 = Seq.index (B.as_seq h bpos) 0 in if is_error pos1 then stop == true /\ (~ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len)) else U64.v pos0 <= U64.v pos1 /\ U64.v pos1 <= U32.v sl.len /\ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len <==> valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos1) sl.len) /\ (stop == true ==> U64.v pos1 == U32.v sl.len) ) inline_for_extraction let validate_list_body (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) : HST.Stack bool (requires (fun h -> validate_list_inv p g0 g1 sl pos0 bpos h false)) (ensures (fun h res h' -> validate_list_inv p g0 g1 sl pos0 bpos h false /\ validate_list_inv p g0 g1 sl pos0 bpos h' res )) = let pos1 = B.index bpos 0ul in assert (U64.v pos1 <= U32.v sl.len); if pos1 = Cast.uint32_to_uint64 sl.len then true else begin Classical.move_requires (valid_exact_list_cons p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; Classical.move_requires (valid_exact_list_cons_recip p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; let pos1 = v sl pos1 in B.upd bpos 0ul pos1; is_error pos1 end
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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
v: LowParse.Low.Base.validator p -> sl: LowParse.Slice.slice rrel rel -> pos: LowParse.Low.ErrorCode.pos_t -> FStar.HyperStack.ST.Stack FStar.UInt64.t
FStar.HyperStack.ST.Stack
[]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Low.Base.validator", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "LowParse.Low.ErrorCode.pos_t", "FStar.UInt64.t", "Prims.unit", "FStar.HyperStack.ST.pop_frame", "LowStar.Monotonic.Buffer.index", "LowStar.Buffer.trivial_preorder", "FStar.UInt32.__uint_to_t", "LowParse.Low.List.valid_exact_list_nil", "LowParse.Slice.__proj__Mkslice__item__len", "C.Loops.do_while", "LowParse.Low.List.validate_list_inv", "LowParse.Low.List.validate_list_body", "Prims.bool", "FStar.Ghost.erased", "FStar.Monotonic.HyperStack.mem", "FStar.Ghost.hide", "FStar.HyperStack.ST.get", "LowStar.Monotonic.Buffer.mbuffer", "Prims.l_and", "Prims.eq2", "Prims.nat", "LowStar.Monotonic.Buffer.length", "FStar.UInt32.v", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Prims.b2t", "Prims.op_Negation", "LowStar.Monotonic.Buffer.g_is_null", "LowStar.Buffer.alloca", "LowStar.Monotonic.Buffer.fresh_frame_modifies", "FStar.HyperStack.ST.push_frame", "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.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "Prims.op_LessThanOrEqual", "FStar.UInt64.v", "LowParse.Slice.live_slice", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_none", "Prims.l_iff", "LowParse.Low.ErrorCode.is_success", "LowParse.Low.Base.Spec.valid_exact", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "LowParse.Low.ErrorCode.uint64_to_uint32", "Prims.l_imp", "Prims.int", "Prims.l_or", "FStar.UInt.size", "FStar.UInt64.n", "FStar.UInt32.n" ]
[]
false
true
false
false
false
let validate_list' (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (#rrel #rel: _) (sl: slice rrel rel) (pos: pos_t) : HST.Stack U64.t (requires (fun h -> k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures (fun h res h' -> B.modifies B.loc_none h h' /\ (is_success res <==> valid_exact (parse_list p) h sl (uint64_to_uint32 pos) sl.len) /\ (is_success res ==> U64.v res == U32.v sl.len))) =
let h0 = HST.get () in let g0 = G.hide h0 in HST.push_frame (); let h02 = HST.get () in B.fresh_frame_modifies h0 h02; let bpos = B.alloca pos 1ul in let h1 = HST.get () in let g1 = G.hide h1 in C.Loops.do_while (validate_list_inv p g0 g1 sl pos bpos) (fun _ -> validate_list_body v g0 g1 sl pos bpos); valid_exact_list_nil p h0 sl sl.len; let posf = B.index bpos 0ul in HST.pop_frame (); posf
false
LowParse.Low.List.fst
LowParse.Low.List.serialized_list_length_eq_length_serialize_list
val serialized_list_length_eq_length_serialize_list (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (l: list t) : Lemma (requires (serialize_list_precond k)) (ensures (serialized_list_length s l == Seq.length (serialize (serialize_list _ s) l)))
val serialized_list_length_eq_length_serialize_list (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (l: list t) : Lemma (requires (serialize_list_precond k)) (ensures (serialized_list_length s l == Seq.length (serialize (serialize_list _ s) l)))
let rec serialized_list_length_eq_length_serialize_list (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (l: list t) : Lemma (requires ( serialize_list_precond k )) (ensures (serialized_list_length s l == Seq.length (serialize (serialize_list _ s) l))) = match l with | [] -> serialize_list_nil _ s; serialized_list_length_nil s | a :: q -> serialize_list_cons _ s a q; serialized_list_length_cons s a q; serialized_list_length_eq_length_serialize_list s q; serialized_length_eq s a
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 28, "end_line": 408, "start_col": 0, "start_line": 389 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1 let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1 let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid_list p h sl pos pos' )) (ensures ( valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos' ; if pos = pos' then valid_exact_list_nil p h sl pos else begin let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos' end let valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos' ))) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq p sq; valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq sq0); assert (injective_postcond p sq sq0); let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let rec valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; if pos = pos' then valid_exact_list_nil p h sl pos else begin valid_exact_list_cons_recip p h sl pos pos'; let pos1 = get_valid_pos p h sl pos in valid_exact_list_valid_list p h sl pos1 pos' end; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let rec valid_exact_list_append (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos1 pos2 pos3 : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos1 pos2 /\ valid_exact (parse_list p) h sl pos2 pos3 )) (ensures ( valid_exact (parse_list p) h sl pos1 pos3 /\ contents_exact (parse_list p) h sl pos1 pos3 == contents_exact (parse_list p) h sl pos1 pos2 `L.append` contents_exact (parse_list p) h sl pos2 pos3 )) (decreases (U32.v pos2 - U32.v pos1)) = if pos1 = pos2 then valid_exact_list_nil p h sl pos1 else begin valid_exact_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_exact_list_append p h sl pos15 pos2 pos3; valid_exact_list_cons p h sl pos1 pos3 end let validate_list_inv (#k: parser_kind) (#t: Type) (p: parser k t) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) (h: HS.mem) (stop: bool) : GTot Type0 = let h0 = G.reveal g0 in let h1 = G.reveal g1 in B.disjoint sl.base bpos /\ k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos0 <= U32.v sl.len /\ live_slice h0 sl /\ B.live h1 bpos /\ B.modifies B.loc_none h0 h1 /\ B.modifies (B.loc_buffer bpos) h1 h /\ ( let pos1 = Seq.index (B.as_seq h bpos) 0 in if is_error pos1 then stop == true /\ (~ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len)) else U64.v pos0 <= U64.v pos1 /\ U64.v pos1 <= U32.v sl.len /\ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len <==> valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos1) sl.len) /\ (stop == true ==> U64.v pos1 == U32.v sl.len) ) inline_for_extraction let validate_list_body (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) : HST.Stack bool (requires (fun h -> validate_list_inv p g0 g1 sl pos0 bpos h false)) (ensures (fun h res h' -> validate_list_inv p g0 g1 sl pos0 bpos h false /\ validate_list_inv p g0 g1 sl pos0 bpos h' res )) = let pos1 = B.index bpos 0ul in assert (U64.v pos1 <= U32.v sl.len); if pos1 = Cast.uint32_to_uint64 sl.len then true else begin Classical.move_requires (valid_exact_list_cons p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; Classical.move_requires (valid_exact_list_cons_recip p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; let pos1 = v sl pos1 in B.upd bpos 0ul pos1; is_error pos1 end inline_for_extraction let validate_list' (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (#rrel #rel: _) (sl: slice rrel rel) (pos: pos_t) : HST.Stack U64.t (requires (fun h -> k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos <= U32.v sl.len /\ live_slice h sl )) (ensures (fun h res h' -> B.modifies B.loc_none h h' /\ (* we could return a boolean, but we would like to return the last validation error code if it fails. (alas, we cannot capture that fact in the spec.) *) (is_success res <==> valid_exact (parse_list p) h sl (uint64_to_uint32 pos) sl.len) /\ (is_success res ==> U64.v res == U32.v sl.len) )) = let h0 = HST.get () in let g0 = G.hide h0 in HST.push_frame (); let h02 = HST.get () in B.fresh_frame_modifies h0 h02; let bpos = B.alloca pos 1ul in let h1 = HST.get () in let g1 = G.hide h1 in C.Loops.do_while (validate_list_inv p g0 g1 sl pos bpos) (fun _ -> validate_list_body v g0 g1 sl pos bpos); valid_exact_list_nil p h0 sl sl.len; let posf = B.index bpos 0ul in HST.pop_frame (); posf inline_for_extraction let validate_list (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (u: squash ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 )) : Tot (validator (parse_list p)) = fun (#rrel #rel: _) (sl: slice rrel rel) pos -> let h = HST.get () in valid_valid_exact_consumes_all (parse_list p) h sl (uint64_to_uint32 pos); validate_list' v sl pos
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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
s: LowParse.Spec.Base.serializer p -> l: Prims.list t -> FStar.Pervasives.Lemma (requires LowParse.Spec.List.serialize_list_precond k) (ensures LowParse.Low.Base.Spec.serialized_list_length s l == FStar.Seq.Base.length (LowParse.Spec.Base.serialize (LowParse.Spec.List.serialize_list p s) l))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "Prims.list", "LowParse.Low.Base.Spec.serialized_list_length_nil", "Prims.unit", "LowParse.Spec.List.serialize_list_nil", "LowParse.Low.Base.Spec.serialized_length_eq", "LowParse.Low.List.serialized_list_length_eq_length_serialize_list", "LowParse.Low.Base.Spec.serialized_list_length_cons", "LowParse.Spec.List.serialize_list_cons", "Prims.b2t", "LowParse.Spec.List.serialize_list_precond", "Prims.squash", "Prims.eq2", "Prims.nat", "LowParse.Low.Base.Spec.serialized_list_length", "FStar.Seq.Base.length", "LowParse.Bytes.byte", "LowParse.Spec.Base.serialize", "LowParse.Spec.List.parse_list_kind", "LowParse.Spec.List.parse_list", "LowParse.Spec.List.serialize_list", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "recursion" ]
false
false
true
false
false
let rec serialized_list_length_eq_length_serialize_list (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (l: list t) : Lemma (requires (serialize_list_precond k)) (ensures (serialized_list_length s l == Seq.length (serialize (serialize_list _ s) l))) =
match l with | [] -> serialize_list_nil _ s; serialized_list_length_nil s | a :: q -> serialize_list_cons _ s a q; serialized_list_length_cons s a q; serialized_list_length_eq_length_serialize_list s q; serialized_length_eq s a
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.heaplet_id_is_some
val heaplet_id_is_some : h: Vale.PPC64LE.InsBasic.vale_heap -> i: Vale.PPC64LE.Memory.heaplet_id -> Prims.logical
let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 28, "end_line": 23, "start_col": 0, "start_line": 22 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
h: Vale.PPC64LE.InsBasic.vale_heap -> i: Vale.PPC64LE.Memory.heaplet_id -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.InsBasic.vale_heap", "Vale.PPC64LE.Memory.heaplet_id", "Prims.eq2", "FStar.Pervasives.Native.option", "Vale.PPC64LE.Memory.get_heaplet_id", "FStar.Pervasives.Native.Some", "Prims.logical" ]
[]
false
false
false
true
true
let heaplet_id_is_some (h: vale_heap) (i: heaplet_id) =
get_heaplet_id h == Some i
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.heaplet_id_is_none
val heaplet_id_is_none : h: Vale.PPC64LE.InsBasic.vale_heap -> Prims.logical
let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 26, "end_line": 20, "start_col": 0, "start_line": 19 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
h: Vale.PPC64LE.InsBasic.vale_heap -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.InsBasic.vale_heap", "Prims.eq2", "FStar.Pervasives.Native.option", "Vale.PPC64LE.Memory.heaplet_id", "Vale.PPC64LE.Memory.get_heaplet_id", "FStar.Pervasives.Native.None", "Prims.logical" ]
[]
false
false
false
true
true
let heaplet_id_is_none (h: vale_heap) =
get_heaplet_id h == None
false
LowParse.Low.List.fst
LowParse.Low.List.validate_list_body
val validate_list_body (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) : HST.Stack bool (requires (fun h -> validate_list_inv p g0 g1 sl pos0 bpos h false)) (ensures (fun h res h' -> validate_list_inv p g0 g1 sl pos0 bpos h false /\ validate_list_inv p g0 g1 sl pos0 bpos h' res))
val validate_list_body (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) : HST.Stack bool (requires (fun h -> validate_list_inv p g0 g1 sl pos0 bpos h false)) (ensures (fun h res h' -> validate_list_inv p g0 g1 sl pos0 bpos h false /\ validate_list_inv p g0 g1 sl pos0 bpos h' res))
let validate_list_body (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) : HST.Stack bool (requires (fun h -> validate_list_inv p g0 g1 sl pos0 bpos h false)) (ensures (fun h res h' -> validate_list_inv p g0 g1 sl pos0 bpos h false /\ validate_list_inv p g0 g1 sl pos0 bpos h' res )) = let pos1 = B.index bpos 0ul in assert (U64.v pos1 <= U32.v sl.len); if pos1 = Cast.uint32_to_uint64 sl.len then true else begin Classical.move_requires (valid_exact_list_cons p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; Classical.move_requires (valid_exact_list_cons_recip p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; let pos1 = v sl pos1 in B.upd bpos 0ul pos1; is_error pos1 end
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 5, "end_line": 330, "start_col": 0, "start_line": 304 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1 let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1 let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid_list p h sl pos pos' )) (ensures ( valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos' ; if pos = pos' then valid_exact_list_nil p h sl pos else begin let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos' end let valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos' ))) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq p sq; valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq sq0); assert (injective_postcond p sq sq0); let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let rec valid_exact_list_valid_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( valid_list p h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; if pos = pos' then valid_exact_list_nil p h sl pos else begin valid_exact_list_cons_recip p h sl pos pos'; let pos1 = get_valid_pos p h sl pos in valid_exact_list_valid_list p h sl pos1 pos' end; contents_list_eq p h sl pos pos' module L = FStar.List.Tot let rec valid_exact_list_append (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos1 pos2 pos3 : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid_exact (parse_list p) h sl pos1 pos2 /\ valid_exact (parse_list p) h sl pos2 pos3 )) (ensures ( valid_exact (parse_list p) h sl pos1 pos3 /\ contents_exact (parse_list p) h sl pos1 pos3 == contents_exact (parse_list p) h sl pos1 pos2 `L.append` contents_exact (parse_list p) h sl pos2 pos3 )) (decreases (U32.v pos2 - U32.v pos1)) = if pos1 = pos2 then valid_exact_list_nil p h sl pos1 else begin valid_exact_list_cons_recip p h sl pos1 pos2; let pos15 = get_valid_pos p h sl pos1 in valid_exact_list_append p h sl pos15 pos2 pos3; valid_exact_list_cons p h sl pos1 pos3 end let validate_list_inv (#k: parser_kind) (#t: Type) (p: parser k t) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) (h: HS.mem) (stop: bool) : GTot Type0 = let h0 = G.reveal g0 in let h1 = G.reveal g1 in B.disjoint sl.base bpos /\ k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ U64.v pos0 <= U32.v sl.len /\ live_slice h0 sl /\ B.live h1 bpos /\ B.modifies B.loc_none h0 h1 /\ B.modifies (B.loc_buffer bpos) h1 h /\ ( let pos1 = Seq.index (B.as_seq h bpos) 0 in if is_error pos1 then stop == true /\ (~ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len)) else U64.v pos0 <= U64.v pos1 /\ U64.v pos1 <= U32.v sl.len /\ (valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos0) sl.len <==> valid_exact (parse_list p) h0 sl (uint64_to_uint32 pos1) sl.len) /\ (stop == true ==> U64.v pos1 == U32.v sl.len) )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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
v: LowParse.Low.Base.validator p -> g0: FStar.Ghost.erased FStar.Monotonic.HyperStack.mem -> g1: FStar.Ghost.erased FStar.Monotonic.HyperStack.mem -> sl: LowParse.Slice.slice rrel rel -> pos0: LowParse.Low.ErrorCode.pos_t -> bpos: LowStar.Buffer.pointer FStar.UInt64.t -> FStar.HyperStack.ST.Stack Prims.bool
FStar.HyperStack.ST.Stack
[]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Low.Base.validator", "FStar.Ghost.erased", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "LowParse.Low.ErrorCode.pos_t", "LowStar.Buffer.pointer", "FStar.UInt64.t", "Prims.op_Equality", "FStar.Int.Cast.uint32_to_uint64", "LowParse.Slice.__proj__Mkslice__item__len", "Prims.bool", "LowParse.Low.ErrorCode.is_error", "Prims.unit", "LowStar.Monotonic.Buffer.upd", "LowStar.Buffer.trivial_preorder", "FStar.UInt32.__uint_to_t", "FStar.Classical.move_requires", "FStar.UInt32.t", "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_disEquality", "LowParse.Low.ErrorCode.uint64_to_uint32", "LowParse.Low.Base.Spec.valid_exact", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "FStar.Ghost.reveal", "LowParse.Low.Base.Spec.valid", "LowParse.Low.Base.Spec.get_valid_pos", "LowParse.Low.Base.Spec.contents_exact", "Prims.Cons", "LowParse.Low.Base.Spec.contents", "LowParse.Low.List.valid_exact_list_cons_recip", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "LowParse.Low.List.valid_exact_list_cons", "Prims._assert", "Prims.op_LessThanOrEqual", "FStar.UInt64.v", "FStar.UInt32.v", "LowStar.Monotonic.Buffer.index", "LowParse.Low.List.validate_list_inv" ]
[]
false
true
false
false
false
let validate_list_body (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) (g0 g1: G.erased HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos0: pos_t) (bpos: B.pointer U64.t) : HST.Stack bool (requires (fun h -> validate_list_inv p g0 g1 sl pos0 bpos h false)) (ensures (fun h res h' -> validate_list_inv p g0 g1 sl pos0 bpos h false /\ validate_list_inv p g0 g1 sl pos0 bpos h' res)) =
let pos1 = B.index bpos 0ul in assert (U64.v pos1 <= U32.v sl.len); if pos1 = Cast.uint32_to_uint64 sl.len then true else (Classical.move_requires (valid_exact_list_cons p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; Classical.move_requires (valid_exact_list_cons_recip p (G.reveal g0) sl (uint64_to_uint32 pos1)) sl.len; let pos1 = v sl pos1 in B.upd bpos 0ul pos1; is_error pos1)
false
LowParse.Low.List.fst
LowParse.Low.List.valid_exact_list_cons_recip
val valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos')) (ensures (k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ (let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos')))
val valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos')) (ensures (k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ (let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos')))
let valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ ( let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos' ))) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq p sq; valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq sq0); assert (injective_postcond p sq sq0); let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos'
{ "file_name": "src/lowparse/LowParse.Low.List.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 49, "end_line": 202, "start_col": 0, "start_line": 167 }
module LowParse.Low.List include LowParse.Spec.List include LowParse.Low.Base module B = LowStar.Buffer module U32 = FStar.UInt32 module CL = C.Loops module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module G = FStar.Ghost module U64 = FStar.UInt64 module Cast = FStar.Int.Cast let valid_exact_list_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos <= U32.v sl.len /\ live_slice h sl)) (ensures ( valid_exact (parse_list p) h sl pos pos /\ contents_exact (parse_list p) h sl pos pos == [] )) = parse_list_eq p (bytes_of_slice_from_to h sl pos pos); valid_exact_equiv (parse_list p) h sl pos pos; contents_exact_eq (parse_list p) h sl pos pos let valid_list_intro_nil (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires (U32.v pos == U32.v sl.len /\ live_slice h sl)) (ensures ( valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == [] )) = parse_list_eq p (bytes_of_slice_from h sl pos); valid_equiv (parse_list p) h sl pos; contents_eq (parse_list p) h sl pos let valid_exact_list_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) (ensures ( k.parser_kind_subkind == Some ParserStrong /\ k.parser_kind_low > 0 /\ valid p h sl pos /\ valid_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' /\ valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl (get_valid_pos p h sl pos) pos' )) = let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq' p sq; let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq0 sq); assert (injective_postcond p sq0 sq); valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos' let valid_list_intro_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) /\ valid (parse_list p) h sl pos /\ contents (parse_list p) h sl pos == contents p h sl pos :: contents (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; valid_facts (parse_list p) h sl pos1 let valid_list_elim_cons (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) : Lemma (requires ( U32.v pos < U32.v sl.len /\ valid (parse_list p) h sl pos )) (ensures ( valid p h sl pos /\ valid (parse_list p) h sl (get_valid_pos p h sl pos) )) = let sq = bytes_of_slice_from h sl pos in parse_list_eq p sq; valid_facts (parse_list p) h sl pos; valid_facts p h sl pos; let pos1 = get_valid_pos p h sl pos in valid_facts (parse_list p) h sl pos1 let rec valid_list_valid_exact_list (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos : U32.t) (pos' : U32.t) : Lemma (requires ( valid_list p h sl pos pos' )) (ensures ( valid_exact (parse_list p) h sl pos pos' /\ contents_exact (parse_list p) h sl pos pos' == contents_list p h sl pos pos' )) (decreases (U32.v pos' - U32.v pos)) = valid_list_equiv p h sl pos pos'; contents_list_eq p h sl pos pos' ; if pos = pos' then valid_exact_list_nil p h sl pos else begin let pos1 = get_valid_pos p h sl pos in valid_list_valid_exact_list p h sl pos1 pos'; valid_exact_list_cons p h sl pos pos' end
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Spec.List.fsti.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Int.Cast.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked", "C.Loops.fst.checked" ], "interface_file": false, "source_file": "LowParse.Low.List.fst" }
[ { "abbrev": true, "full_module": "FStar.Int.Cast", "short_module": "Cast" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "C.Loops", "short_module": "CL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParse.Low.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.List", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Low", "short_module": null }, { "abbrev": 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 Mkparser_kind'?.parser_kind_subkind k == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\ pos <> pos' /\ LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_list p) h sl pos pos') (ensures Mkparser_kind'?.parser_kind_subkind k == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\ pos <> pos' /\ LowParse.Low.Base.Spec.valid_exact (LowParse.Spec.List.parse_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_exact (LowParse.Spec.List.parse_list p) h sl pos1 pos' /\ LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl pos pos' == LowParse.Low.Base.Spec.contents p h sl pos :: LowParse.Low.Base.Spec.contents_exact (LowParse.Spec.List.parse_list p) h sl pos1 pos'))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "FStar.Monotonic.HyperStack.mem", "LowParse.Slice.srel", "LowParse.Bytes.byte", "LowParse.Slice.slice", "FStar.UInt32.t", "LowParse.Low.Base.Spec.contents_exact_eq", "LowParse.Spec.List.parse_list_kind", "Prims.list", "LowParse.Spec.List.parse_list", "Prims.unit", "LowParse.Low.Base.Spec.valid_exact_equiv", "LowParse.Low.Base.Spec.get_valid_pos", "Prims._assert", "LowParse.Spec.Base.injective_postcond", "LowParse.Spec.Base.no_lookahead_on", "LowParse.Spec.Base.parser_kind_prop_equiv", "LowParse.Bytes.bytes", "LowParse.Slice.bytes_of_slice_from", "LowParse.Low.Base.Spec.valid_facts", "LowParse.Spec.List.parse_list_eq", "LowParse.Low.Base.Spec.bytes_of_slice_from_to", "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_disEquality", "LowParse.Low.Base.Spec.valid_exact", "Prims.squash", "LowParse.Low.Base.Spec.valid", "LowParse.Low.Base.Spec.contents_exact", "Prims.Cons", "LowParse.Low.Base.Spec.contents", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let valid_exact_list_cons_recip (#k: parser_kind) (#t: Type) (p: parser k t) (h: HS.mem) (#rrel #rel: _) (sl: slice rrel rel) (pos pos': U32.t) : Lemma (requires (k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos')) (ensures (k.parser_kind_subkind == Some ParserStrong /\ pos <> pos' /\ valid_exact (parse_list p) h sl pos pos' /\ valid p h sl pos /\ (let pos1 = get_valid_pos p h sl pos in valid_exact (parse_list p) h sl pos1 pos' /\ contents_exact (parse_list p) h sl pos pos' == contents p h sl pos :: contents_exact (parse_list p) h sl pos1 pos'))) =
let sq = bytes_of_slice_from_to h sl pos pos' in parse_list_eq p sq; valid_exact_equiv (parse_list p) h sl pos pos'; valid_facts p h sl pos; let sq0 = bytes_of_slice_from h sl pos in parser_kind_prop_equiv k p; assert (no_lookahead_on p sq sq0); assert (injective_postcond p sq sq0); let pos1 = get_valid_pos p h sl pos in valid_exact_equiv (parse_list p) h sl pos1 pos'; contents_exact_eq (parse_list p) h sl pos pos'; contents_exact_eq (parse_list p) h sl pos1 pos'
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.norm_loc
val norm_loc (l: loc) : loc
val norm_loc (l: loc) : loc
let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 87, "end_line": 31, "start_col": 7, "start_line": 30 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = ()
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
l: Vale.PPC64LE.Memory.loc -> Vale.PPC64LE.Memory.loc
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Memory.loc", "FStar.Pervasives.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.zeta", "FStar.Pervasives.iota", "FStar.Pervasives.delta_only", "Prims.string", "Prims.Nil", "FStar.Pervasives.delta_attr" ]
[]
false
false
false
true
false
let norm_loc (l: loc) : loc =
norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.norm_list
val norm_list (p: prop) : prop
val norm_list (p: prop) : prop
let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 26, "start_col": 7, "start_line": 25 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
p: Prims.prop -> Prims.prop
Prims.Tot
[ "total" ]
[]
[ "Prims.prop", "FStar.Pervasives.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.zeta", "FStar.Pervasives.iota", "FStar.Pervasives.delta_only", "Prims.string", "Prims.Nil" ]
[]
false
false
false
true
true
let norm_list (p: prop) : prop =
norm [zeta; iota; delta_only [`%list_to_seq_post]] p
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.trigger_create_heaplet
val trigger_create_heaplet : h: Vale.PPC64LE.Memory.heaplet_id -> Prims.logical
let trigger_create_heaplet (h:heaplet_id) = True
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 48, "end_line": 33, "start_col": 0, "start_line": 33 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
h: Vale.PPC64LE.Memory.heaplet_id -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Memory.heaplet_id", "Prims.l_True", "Prims.logical" ]
[]
false
false
false
true
true
let trigger_create_heaplet (h: heaplet_id) =
True
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.declare_buffer128
val declare_buffer128 (b: buffer TUInt128) (hid: heaplet_id) (t: taint) (mut: mutability) : buffer_info
val declare_buffer128 (b: buffer TUInt128) (hid: heaplet_id) (t: taint) (mut: mutability) : buffer_info
let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 36, "end_line": 41, "start_col": 7, "start_line": 40 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
b: Vale.PPC64LE.Memory.buffer Vale.Arch.HeapTypes_s.TUInt128 -> hid: Vale.PPC64LE.Memory.heaplet_id -> t: Vale.Arch.HeapTypes_s.taint -> mut: Vale.Arch.HeapImpl.mutability -> Vale.Arch.HeapImpl.buffer_info
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Memory.buffer", "Vale.Arch.HeapTypes_s.TUInt128", "Vale.PPC64LE.Memory.heaplet_id", "Vale.Arch.HeapTypes_s.taint", "Vale.Arch.HeapImpl.mutability", "Vale.Arch.HeapImpl.Mkbuffer_info", "Vale.Arch.HeapImpl.buffer_info" ]
[]
false
false
false
true
false
let declare_buffer128 (b: buffer TUInt128) (hid: heaplet_id) (t: taint) (mut: mutability) : buffer_info =
Mkbuffer_info TUInt128 b hid t mut
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.declare_buffer64
val declare_buffer64 (b: buffer TUInt64) (hid: heaplet_id) (t: taint) (mut: mutability) : buffer_info
val declare_buffer64 (b: buffer TUInt64) (hid: heaplet_id) (t: taint) (mut: mutability) : buffer_info
let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 35, "end_line": 37, "start_col": 7, "start_line": 36 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
b: Vale.PPC64LE.Memory.buffer Vale.Arch.HeapTypes_s.TUInt64 -> hid: Vale.PPC64LE.Memory.heaplet_id -> t: Vale.Arch.HeapTypes_s.taint -> mut: Vale.Arch.HeapImpl.mutability -> Vale.Arch.HeapImpl.buffer_info
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Memory.buffer", "Vale.Arch.HeapTypes_s.TUInt64", "Vale.PPC64LE.Memory.heaplet_id", "Vale.Arch.HeapTypes_s.taint", "Vale.Arch.HeapImpl.mutability", "Vale.Arch.HeapImpl.Mkbuffer_info", "Vale.Arch.HeapImpl.buffer_info" ]
[]
false
false
false
true
false
let declare_buffer64 (b: buffer TUInt64) (hid: heaplet_id) (t: taint) (mut: mutability) : buffer_info =
Mkbuffer_info TUInt64 b hid t mut
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.va_wp_DestroyHeaplets
val va_wp_DestroyHeaplets (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
val va_wp_DestroyHeaplets (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
let va_wp_DestroyHeaplets (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) ==> va_k va_sM (())))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 76, "end_line": 147, "start_col": 0, "start_line": 136 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut [@norm_loc_attr] unfold let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut let create_post (layout:vale_heap_layout) (bs:Seq.seq buffer_info) = forall (i:nat).{:pattern Seq.index bs i} i < Seq.length bs ==> ( let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable)) //-- CreateHeaplets val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_CreateHeaplets (buffers:(list buffer_info)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) ==> va_k va_sM (()))) val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_CreateHeaplets (buffers:(list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ())) = (va_QProc (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) (va_wp_CreateHeaplets buffers) (va_wpProof_CreateHeaplets buffers)) //-- //-- DestroyHeaplets val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Type0
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Prims.l_and", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Vale.PPC64LE.Memory.layout_heaplets_initialized", "Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout__item__vl_inner", "Vale.PPC64LE.Decls.va_get_mem_layout", "Prims.l_Forall", "Vale.Arch.HeapImpl.vale_heap_layout", "Prims.l_imp", "Vale.PPC64LE.Decls.modifies_mem", "Vale.PPC64LE.Memory.layout_modifies_loc", "Vale.PPC64LE.Memory.layout_old_heap", "Vale.PPC64LE.Decls.va_get_mem", "Prims.eq2", "Vale.Arch.HeapTypes_s.memTaint_t", "Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout__item__vl_taint", "Vale.PPC64LE.InsMem.heaplet_id_is_none", "Vale.PPC64LE.Memory.heaplet_id", "Vale.PPC64LE.InsMem.trigger_create_heaplet", "Vale.PPC64LE.Memory.heaps_match", "Vale.PPC64LE.Memory.layout_buffers", "Vale.PPC64LE.Decls.va_get_mem_heaplet", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.Decls.va_upd_mem_layout" ]
[]
false
false
false
true
true
let va_wp_DestroyHeaplets (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner) /\ (forall (va_x_memLayout: vale_heap_layout). let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0 ) .vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h: heaplet_id). {:pattern (trigger_create_heaplet h)} trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0 ) .vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) ==> va_k va_sM (())))
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.va_wp_MemLoad64
val va_wp_MemLoad64 (h: va_operand_heaplet) (dst base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
val va_wp_MemLoad64 (h: va_operand_heaplet) (dst base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
let va_wp_MemLoad64 (h:va_operand_heaplet) (dst:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index /\ (forall (va_x_dst:va_value_reg_opr) . let va_sM = va_upd_operand_reg_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) ==> va_k va_sM (())))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 51, "end_line": 197, "start_col": 0, "start_line": 184 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut [@norm_loc_attr] unfold let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut let create_post (layout:vale_heap_layout) (bs:Seq.seq buffer_info) = forall (i:nat).{:pattern Seq.index bs i} i < Seq.length bs ==> ( let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable)) //-- CreateHeaplets val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_CreateHeaplets (buffers:(list buffer_info)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) ==> va_k va_sM (()))) val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_CreateHeaplets (buffers:(list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ())) = (va_QProc (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) (va_wp_CreateHeaplets buffers) (va_wpProof_CreateHeaplets buffers)) //-- //-- DestroyHeaplets val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_DestroyHeaplets (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) ==> va_k va_sM (()))) val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_DestroyHeaplets () : (va_quickCode unit (va_code_DestroyHeaplets ())) = (va_QProc (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_wp_DestroyHeaplets va_wpProof_DestroyHeaplets) //-- //-- MemLoad64 val va_code_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code val va_codegen_success_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool val va_lemma_MemLoad64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemLoad64 h dst base offset t) va_s0 /\ va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
h: Vale.PPC64LE.Decls.va_operand_heaplet -> dst: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> b: Vale.PPC64LE.Memory.buffer64 -> index: Prims.int -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Type0
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Memory.buffer64", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Prims.l_and", "Vale.PPC64LE.Decls.va_is_src_heaplet", "Vale.PPC64LE.Decls.va_is_dst_reg_opr", "Vale.PPC64LE.Decls.va_is_src_reg_opr", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Vale.PPC64LE.Machine_s.valid_maddr_offset64", "Vale.PPC64LE.Decls.valid_src_addr", "Vale.PPC64LE.Memory.vuint64", "Vale.PPC64LE.Decls.va_eval_heaplet", "Vale.PPC64LE.Memory.valid_layout_buffer", "Vale.PPC64LE.Decls.va_get_mem_layout", "Vale.PPC64LE.Memory.valid_taint_buf64", "Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout__item__vl_taint", "Prims.eq2", "Prims.op_Addition", "Vale.PPC64LE.Decls.va_eval_reg_opr", "Vale.PPC64LE.Memory.buffer_addr", "Prims.op_Multiply", "Prims.l_Forall", "Vale.PPC64LE.Decls.va_value_reg_opr", "Prims.l_imp", "Vale.PPC64LE.Machine_s.nat64", "Vale.PPC64LE.Decls.buffer64_read", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.Decls.va_upd_operand_reg_opr" ]
[]
false
false
false
true
true
let va_wp_MemLoad64 (h: va_operand_heaplet) (dst base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
(va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index /\ (forall (va_x_dst: va_value_reg_opr). let va_sM = va_upd_operand_reg_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) ==> va_k va_sM (())))
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.buffer64_write
val buffer64_write (b: buffer64) (i: int) (v: nat64) (h: vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True)
val buffer64_write (b: buffer64) (i: int) (v: nat64) (h: vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True)
let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 17, "start_col": 0, "start_line": 13 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
b: Vale.PPC64LE.Memory.buffer64 -> i: Prims.int -> v: Vale.PPC64LE.Memory.nat64 -> h: Vale.PPC64LE.InsBasic.vale_heap -> Prims.Ghost Vale.PPC64LE.InsBasic.vale_heap
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Memory.buffer64", "Prims.int", "Vale.PPC64LE.Memory.nat64", "Vale.PPC64LE.InsBasic.vale_heap", "Vale.PPC64LE.Memory.buffer_write", "Vale.PPC64LE.Memory.vuint64", "Prims.l_and", "Vale.PPC64LE.Memory.buffer_readable", "Vale.PPC64LE.Memory.buffer_writeable", "Prims.l_True" ]
[]
false
false
false
false
false
let buffer64_write (b: buffer64) (i: int) (v: nat64) (h: vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) =
buffer_write b i v h
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.va_quick_CreateHeaplets
val va_quick_CreateHeaplets (buffers: (list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ()))
val va_quick_CreateHeaplets (buffers: (list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ()))
let va_quick_CreateHeaplets (buffers:(list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ())) = (va_QProc (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) (va_wp_CreateHeaplets buffers) (va_wpProof_CreateHeaplets buffers))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 40, "end_line": 113, "start_col": 0, "start_line": 110 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut [@norm_loc_attr] unfold let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut let create_post (layout:vale_heap_layout) (bs:Seq.seq buffer_info) = forall (i:nat).{:pattern Seq.index bs i} i < Seq.length bs ==> ( let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable)) //-- CreateHeaplets val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_CreateHeaplets (buffers:(list buffer_info)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) ==> va_k va_sM (()))) val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
buffers: Prims.list Vale.Arch.HeapImpl.buffer_info -> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit (Vale.PPC64LE.InsMem.va_code_CreateHeaplets ())
Prims.Tot
[ "total" ]
[]
[ "Prims.list", "Vale.Arch.HeapImpl.buffer_info", "Vale.PPC64LE.QuickCode.va_QProc", "Prims.unit", "Vale.PPC64LE.InsMem.va_code_CreateHeaplets", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_mem_layout", "Prims.Nil", "Vale.PPC64LE.InsMem.va_wp_CreateHeaplets", "Vale.PPC64LE.InsMem.va_wpProof_CreateHeaplets", "Vale.PPC64LE.QuickCode.va_quickCode" ]
[]
false
false
false
false
false
let va_quick_CreateHeaplets (buffers: (list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ())) =
(va_QProc (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) (va_wp_CreateHeaplets buffers) (va_wpProof_CreateHeaplets buffers))
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.va_wp_CreateHeaplets
val va_wp_CreateHeaplets (buffers: (list buffer_info)) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
val va_wp_CreateHeaplets (buffers: (list buffer_info)) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
let va_wp_CreateHeaplets (buffers:(list buffer_info)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) ==> va_k va_sM (())))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 77, "end_line": 101, "start_col": 0, "start_line": 80 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut [@norm_loc_attr] unfold let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut let create_post (layout:vale_heap_layout) (bs:Seq.seq buffer_info) = forall (i:nat).{:pattern Seq.index bs i} i < Seq.length bs ==> ( let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable)) //-- CreateHeaplets val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
buffers: Prims.list Vale.Arch.HeapImpl.buffer_info -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.list", "Vale.Arch.HeapImpl.buffer_info", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Prims.l_and", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Vale.PPC64LE.Memory.is_initial_heap", "Vale.PPC64LE.Decls.va_get_mem_layout", "Vale.PPC64LE.Decls.va_get_mem", "Prims.l_imp", "Vale.PPC64LE.InsMem.norm_list", "Vale.Lib.Seqs.list_to_seq_post", "Vale.PPC64LE.Memory.init_heaplets_req", "FStar.Seq.Base.seq", "Vale.Lib.Seqs.list_to_seq", "Prims.l_Forall", "Vale.Arch.HeapImpl.vale_heap_layout", "Prims.eq2", "Vale.PPC64LE.Memory.loc", "Vale.PPC64LE.Memory.layout_modifies_loc", "Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout__item__vl_inner", "Vale.PPC64LE.InsMem.norm_loc", "Vale.PPC64LE.Memory.loc_mutable_buffers", "Vale.PPC64LE.Memory.vale_heap", "Vale.PPC64LE.Memory.layout_old_heap", "Vale.PPC64LE.Memory.layout_buffers", "Vale.PPC64LE.Memory.layout_heaplets_initialized", "Vale.Arch.HeapTypes_s.memTaint_t", "Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout__item__vl_taint", "Vale.PPC64LE.InsMem.create_post", "Vale.PPC64LE.InsMem.heaplet_id_is_none", "Vale.PPC64LE.Memory.heaplet_id", "Vale.PPC64LE.InsMem.trigger_create_heaplet", "Vale.PPC64LE.InsMem.heaplet_id_is_some", "Vale.PPC64LE.Decls.va_get_mem_heaplet", "Vale.PPC64LE.Memory.heaps_match", "Prims.nat", "Prims.op_LessThan", "FStar.Seq.Base.length", "Vale.PPC64LE.Memory.buffer_info_has_id", "Vale.Arch.HeapImpl.__proj__Mkbuffer_info__item__bi_heaplet", "FStar.Seq.Base.index", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.Decls.va_upd_mem_layout" ]
[]
false
false
false
true
true
let va_wp_CreateHeaplets (buffers: (list buffer_info)) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let bs:(FStar.Seq.Base.seq buffer_info) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)) /\ (forall (va_x_memLayout: vale_heap_layout). let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ (let bs:(FStar.Seq.Base.seq buffer_info) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h: heaplet_id). {:pattern (trigger_create_heaplet h)} trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i: nat). {:pattern (Seq.index bs i)} i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) ==> va_k va_sM (())))
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.create_post
val create_post : layout: Vale.Arch.HeapImpl.vale_heap_layout -> bs: FStar.Seq.Base.seq Vale.Arch.HeapImpl.buffer_info -> Prims.logical
let create_post (layout:vale_heap_layout) (bs:Seq.seq buffer_info) = forall (i:nat).{:pattern Seq.index bs i} i < Seq.length bs ==> ( let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 65, "end_line": 48, "start_col": 0, "start_line": 43 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut [@norm_loc_attr] unfold let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
layout: Vale.Arch.HeapImpl.vale_heap_layout -> bs: FStar.Seq.Base.seq Vale.Arch.HeapImpl.buffer_info -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Vale.Arch.HeapImpl.vale_heap_layout", "FStar.Seq.Base.seq", "Vale.Arch.HeapImpl.buffer_info", "Prims.l_Forall", "Prims.nat", "Prims.l_imp", "Prims.b2t", "Prims.op_LessThan", "FStar.Seq.Base.length", "Vale.Arch.HeapTypes_s.base_typ", "Vale.Arch.HeapImpl.buffer", "Vale.Arch.HeapImpl.heaplet_id", "Vale.Arch.HeapTypes_s.taint", "Vale.Arch.HeapImpl.mutability", "Prims.l_and", "Vale.PPC64LE.InsMem.trigger_create_heaplet", "Vale.PPC64LE.Memory.valid_layout_buffer_id", "FStar.Pervasives.Native.Some", "Vale.PPC64LE.Memory.heaplet_id", "Prims.op_Equality", "Vale.Arch.HeapImpl.Mutable", "Prims.logical", "FStar.Seq.Base.index" ]
[]
false
false
false
true
true
let create_post (layout: vale_heap_layout) (bs: Seq.seq buffer_info) =
forall (i: nat). {:pattern Seq.index bs i} i < Seq.length bs ==> (let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable))
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.state_t
val state_t : Type0
let state_t = Hacl.Streaming.MD.state_32
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 40, "end_line": 33, "start_col": 0, "start_line": 33 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5 inline_for_extraction noextract let state_t_md5 = state_t MD5
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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
Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.MD.state_32" ]
[]
false
false
false
true
true
let state_t =
Hacl.Streaming.MD.state_32
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.va_quick_DestroyHeaplets
val va_quick_DestroyHeaplets: Prims.unit -> (va_quickCode unit (va_code_DestroyHeaplets ()))
val va_quick_DestroyHeaplets: Prims.unit -> (va_quickCode unit (va_code_DestroyHeaplets ()))
let va_quick_DestroyHeaplets () : (va_quickCode unit (va_code_DestroyHeaplets ())) = (va_QProc (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_wp_DestroyHeaplets va_wpProof_DestroyHeaplets)
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 157, "start_col": 0, "start_line": 155 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut [@norm_loc_attr] unfold let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut let create_post (layout:vale_heap_layout) (bs:Seq.seq buffer_info) = forall (i:nat).{:pattern Seq.index bs i} i < Seq.length bs ==> ( let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable)) //-- CreateHeaplets val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_CreateHeaplets (buffers:(list buffer_info)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) ==> va_k va_sM (()))) val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_CreateHeaplets (buffers:(list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ())) = (va_QProc (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) (va_wp_CreateHeaplets buffers) (va_wpProof_CreateHeaplets buffers)) //-- //-- DestroyHeaplets val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_DestroyHeaplets (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) ==> va_k va_sM (()))) val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
_: Prims.unit -> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit (Vale.PPC64LE.InsMem.va_code_DestroyHeaplets ())
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.PPC64LE.QuickCode.va_QProc", "Vale.PPC64LE.InsMem.va_code_DestroyHeaplets", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_mem_layout", "Prims.Nil", "Vale.PPC64LE.InsMem.va_wp_DestroyHeaplets", "Vale.PPC64LE.InsMem.va_wpProof_DestroyHeaplets", "Vale.PPC64LE.QuickCode.va_quickCode" ]
[]
false
false
false
false
false
let va_quick_DestroyHeaplets () : (va_quickCode unit (va_code_DestroyHeaplets ())) =
(va_QProc (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_wp_DestroyHeaplets va_wpProof_DestroyHeaplets)
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.va_wp_MemStore64
val va_wp_MemStore64 (h: va_operand_heaplet) (src base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
val va_wp_MemStore64 (h: va_operand_heaplet) (src base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
let va_wp_MemStore64 (h:va_operand_heaplet) (src:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index /\ (forall (va_x_h:va_value_heaplet) (va_x_mem:vale_heap) . let va_sM = va_upd_mem va_x_mem (va_upd_operand_heaplet h va_x_h va_s0) in va_get_ok va_sM /\ va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet va_s0 h) ==> va_k va_sM (())))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 10, "end_line": 253, "start_col": 0, "start_line": 239 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut [@norm_loc_attr] unfold let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut let create_post (layout:vale_heap_layout) (bs:Seq.seq buffer_info) = forall (i:nat).{:pattern Seq.index bs i} i < Seq.length bs ==> ( let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable)) //-- CreateHeaplets val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_CreateHeaplets (buffers:(list buffer_info)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) ==> va_k va_sM (()))) val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_CreateHeaplets (buffers:(list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ())) = (va_QProc (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) (va_wp_CreateHeaplets buffers) (va_wpProof_CreateHeaplets buffers)) //-- //-- DestroyHeaplets val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_DestroyHeaplets (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) ==> va_k va_sM (()))) val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_DestroyHeaplets () : (va_quickCode unit (va_code_DestroyHeaplets ())) = (va_QProc (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_wp_DestroyHeaplets va_wpProof_DestroyHeaplets) //-- //-- MemLoad64 val va_code_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code val va_codegen_success_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool val va_lemma_MemLoad64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemLoad64 h dst base offset t) va_s0 /\ va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)))) [@ va_qattr] let va_wp_MemLoad64 (h:va_operand_heaplet) (dst:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index /\ (forall (va_x_dst:va_value_reg_opr) . let va_sM = va_upd_operand_reg_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) ==> va_k va_sM (()))) val va_wpProof_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_MemLoad64 h dst base offset t b index va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemLoad64 h dst base offset t) ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_MemLoad64 (h:va_operand_heaplet) (dst:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) : (va_quickCode unit (va_code_MemLoad64 h dst base offset t)) = (va_QProc (va_code_MemLoad64 h dst base offset t) ([va_mod_reg_opr dst]) (va_wp_MemLoad64 h dst base offset t b index) (va_wpProof_MemLoad64 h dst base offset t b index)) //-- //-- MemStore64 val va_code_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code val va_codegen_success_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool val va_lemma_MemStore64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemStore64 h src base offset t) va_s0 /\ va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet va_s0 h) /\ va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM (va_update_operand_heaplet h va_sM va_s0)))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
h: Vale.PPC64LE.Decls.va_operand_heaplet -> src: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> b: Vale.PPC64LE.Memory.buffer64 -> index: Prims.int -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Type0
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Memory.buffer64", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Prims.l_and", "Vale.PPC64LE.Decls.va_is_dst_heaplet", "Vale.PPC64LE.Decls.va_is_src_reg_opr", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Vale.PPC64LE.Machine_s.valid_maddr_offset64", "Vale.PPC64LE.Decls.valid_dst_addr", "Vale.PPC64LE.Memory.vuint64", "Vale.PPC64LE.Decls.va_eval_heaplet", "Vale.PPC64LE.Memory.valid_layout_buffer", "Vale.PPC64LE.Decls.va_get_mem_layout", "Vale.PPC64LE.Memory.valid_taint_buf64", "Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout__item__vl_taint", "Prims.eq2", "Prims.op_Addition", "Vale.PPC64LE.Decls.va_eval_reg_opr", "Vale.PPC64LE.Memory.buffer_addr", "Prims.op_Multiply", "Prims.l_Forall", "Vale.PPC64LE.Decls.va_value_heaplet", "Vale.PPC64LE.InsBasic.vale_heap", "Prims.l_imp", "Vale.PPC64LE.Memory.vale_heap", "Vale.PPC64LE.InsMem.buffer64_write", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.Decls.va_upd_mem", "Vale.PPC64LE.Decls.va_upd_operand_heaplet" ]
[]
false
false
false
true
true
let va_wp_MemStore64 (h: va_operand_heaplet) (src base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
(va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index /\ (forall (va_x_h: va_value_heaplet) (va_x_mem: vale_heap). let va_sM = va_upd_mem va_x_mem (va_upd_operand_heaplet h va_x_h va_s0) in va_get_ok va_sM /\ va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet va_s0 h) ==> va_k va_sM (())))
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.va_quick_MemLoad64
val va_quick_MemLoad64 (h: va_operand_heaplet) (dst base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) : (va_quickCode unit (va_code_MemLoad64 h dst base offset t))
val va_quick_MemLoad64 (h: va_operand_heaplet) (dst base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) : (va_quickCode unit (va_code_MemLoad64 h dst base offset t))
let va_quick_MemLoad64 (h:va_operand_heaplet) (dst:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) : (va_quickCode unit (va_code_MemLoad64 h dst base offset t)) = (va_QProc (va_code_MemLoad64 h dst base offset t) ([va_mod_reg_opr dst]) (va_wp_MemLoad64 h dst base offset t b index) (va_wpProof_MemLoad64 h dst base offset t b index))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 78, "end_line": 211, "start_col": 0, "start_line": 207 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut [@norm_loc_attr] unfold let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut let create_post (layout:vale_heap_layout) (bs:Seq.seq buffer_info) = forall (i:nat).{:pattern Seq.index bs i} i < Seq.length bs ==> ( let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable)) //-- CreateHeaplets val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_CreateHeaplets (buffers:(list buffer_info)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) ==> va_k va_sM (()))) val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_CreateHeaplets (buffers:(list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ())) = (va_QProc (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) (va_wp_CreateHeaplets buffers) (va_wpProof_CreateHeaplets buffers)) //-- //-- DestroyHeaplets val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_DestroyHeaplets (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) ==> va_k va_sM (()))) val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_DestroyHeaplets () : (va_quickCode unit (va_code_DestroyHeaplets ())) = (va_QProc (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_wp_DestroyHeaplets va_wpProof_DestroyHeaplets) //-- //-- MemLoad64 val va_code_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code val va_codegen_success_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool val va_lemma_MemLoad64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemLoad64 h dst base offset t) va_s0 /\ va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)))) [@ va_qattr] let va_wp_MemLoad64 (h:va_operand_heaplet) (dst:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index /\ (forall (va_x_dst:va_value_reg_opr) . let va_sM = va_upd_operand_reg_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) ==> va_k va_sM (()))) val va_wpProof_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_MemLoad64 h dst base offset t b index va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemLoad64 h dst base offset t) ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
h: Vale.PPC64LE.Decls.va_operand_heaplet -> dst: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> b: Vale.PPC64LE.Memory.buffer64 -> index: Prims.int -> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit (Vale.PPC64LE.InsMem.va_code_MemLoad64 h dst base offset t)
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Memory.buffer64", "Vale.PPC64LE.QuickCode.va_QProc", "Prims.unit", "Vale.PPC64LE.InsMem.va_code_MemLoad64", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_mod_reg_opr", "Prims.Nil", "Vale.PPC64LE.InsMem.va_wp_MemLoad64", "Vale.PPC64LE.InsMem.va_wpProof_MemLoad64", "Vale.PPC64LE.QuickCode.va_quickCode" ]
[]
false
false
false
false
false
let va_quick_MemLoad64 (h: va_operand_heaplet) (dst base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) : (va_quickCode unit (va_code_MemLoad64 h dst base offset t)) =
(va_QProc (va_code_MemLoad64 h dst base offset t) ([va_mod_reg_opr dst]) (va_wp_MemLoad64 h dst base offset t b index) (va_wpProof_MemLoad64 h dst base offset t b index))
false
Vale.PPC64LE.InsMem.fsti
Vale.PPC64LE.InsMem.va_quick_MemStore64
val va_quick_MemStore64 (h: va_operand_heaplet) (src base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) : (va_quickCode unit (va_code_MemStore64 h src base offset t))
val va_quick_MemStore64 (h: va_operand_heaplet) (src base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) : (va_quickCode unit (va_code_MemStore64 h src base offset t))
let va_quick_MemStore64 (h:va_operand_heaplet) (src:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) : (va_quickCode unit (va_code_MemStore64 h src base offset t)) = (va_QProc (va_code_MemStore64 h src base offset t) ([va_Mod_mem; va_mod_heaplet h]) (va_wp_MemStore64 h src base offset t b index) (va_wpProof_MemStore64 h src base offset t b index))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 11, "end_line": 268, "start_col": 0, "start_line": 263 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.QuickCode open FStar.Seq open Vale.Def.Types_s open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl open Vale.PPC64LE.Memory open Vale.PPC64LE.InsBasic open Vale.Lib.Seqs let buffer64_write (b:buffer64) (i:int) (v:nat64) (h:vale_heap) : Ghost vale_heap (requires buffer_readable h b /\ buffer_writeable b) (ensures fun _ -> True) = buffer_write b i v h let heaplet_id_is_none (h:vale_heap) = get_heaplet_id h == None let heaplet_id_is_some (h:vale_heap) (i:heaplet_id) = get_heaplet_id h == Some i unfold let norm_list (p:prop) : prop = norm [zeta; iota; delta_only [`%list_to_seq_post]] p irreducible let norm_loc_attr = () unfold let norm_loc (l:loc) : loc = norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l let trigger_create_heaplet (h:heaplet_id) = True [@norm_loc_attr] unfold let declare_buffer64 (b:buffer TUInt64) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt64 b hid t mut [@norm_loc_attr] unfold let declare_buffer128 (b:buffer TUInt128) (hid:heaplet_id) (t:taint) (mut:mutability) : buffer_info = Mkbuffer_info TUInt128 b hid t mut let create_post (layout:vale_heap_layout) (bs:Seq.seq buffer_info) = forall (i:nat).{:pattern Seq.index bs i} i < Seq.length bs ==> ( let Mkbuffer_info t b hid _ mut = Seq.index bs i in trigger_create_heaplet hid /\ valid_layout_buffer_id t b layout (Some hid) false /\ valid_layout_buffer_id t b layout (Some hid) (mut = Mutable)) //-- CreateHeaplets val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_CreateHeaplets (buffers:(list buffer_info)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) ==> va_k va_sM (()))) val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_CreateHeaplets (buffers:(list buffer_info)) : (va_quickCode unit (va_code_CreateHeaplets ())) = (va_QProc (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) (va_wp_CreateHeaplets buffers) (va_wpProof_CreateHeaplets buffers)) //-- //-- DestroyHeaplets val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)))) [@ va_qattr] let va_wp_DestroyHeaplets (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner) /\ (forall (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout va_x_memLayout va_s0 in va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) ==> va_k va_sM (()))) val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_DestroyHeaplets () : (va_quickCode unit (va_code_DestroyHeaplets ())) = (va_QProc (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_wp_DestroyHeaplets va_wpProof_DestroyHeaplets) //-- //-- MemLoad64 val va_code_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code val va_codegen_success_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool val va_lemma_MemLoad64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemLoad64 h dst base offset t) va_s0 /\ va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)))) [@ va_qattr] let va_wp_MemLoad64 (h:va_operand_heaplet) (dst:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index /\ (forall (va_x_dst:va_value_reg_opr) . let va_sM = va_upd_operand_reg_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) ==> va_k va_sM (()))) val va_wpProof_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_MemLoad64 h dst base offset t b index va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemLoad64 h dst base offset t) ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@ "opaque_to_smt" va_qattr] let va_quick_MemLoad64 (h:va_operand_heaplet) (dst:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) : (va_quickCode unit (va_code_MemLoad64 h dst base offset t)) = (va_QProc (va_code_MemLoad64 h dst base offset t) ([va_mod_reg_opr dst]) (va_wp_MemLoad64 h dst base offset t b index) (va_wpProof_MemLoad64 h dst base offset t b index)) //-- //-- MemStore64 val va_code_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code val va_codegen_success_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool val va_lemma_MemStore64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemStore64 h src base offset t) va_s0 /\ va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet va_s0 h) /\ va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM (va_update_operand_heaplet h va_sM va_s0))))) [@ va_qattr] let va_wp_MemStore64 (h:va_operand_heaplet) (src:va_operand_reg_opr) (base:va_operand_reg_opr) (offset:int) (t:taint) (b:buffer64) (index:int) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index /\ (forall (va_x_h:va_value_heaplet) (va_x_mem:vale_heap) . let va_sM = va_upd_mem va_x_mem (va_upd_operand_heaplet h va_x_h va_s0) in va_get_ok va_sM /\ va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet va_s0 h) ==> va_k va_sM (()))) val va_wpProof_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_MemStore64 h src base offset t b index va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemStore64 h src base offset t) ([va_Mod_mem; va_mod_heaplet h]) va_s0 va_k ((va_sM, va_f0, va_g))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.InsMem.fsti" }
[ { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_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
h: Vale.PPC64LE.Decls.va_operand_heaplet -> src: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> b: Vale.PPC64LE.Memory.buffer64 -> index: Prims.int -> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit (Vale.PPC64LE.InsMem.va_code_MemStore64 h src base offset t)
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Memory.buffer64", "Vale.PPC64LE.QuickCode.va_QProc", "Prims.unit", "Vale.PPC64LE.InsMem.va_code_MemStore64", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_mem", "Vale.PPC64LE.QuickCode.va_mod_heaplet", "Prims.Nil", "Vale.PPC64LE.InsMem.va_wp_MemStore64", "Vale.PPC64LE.InsMem.va_wpProof_MemStore64", "Vale.PPC64LE.QuickCode.va_quickCode" ]
[]
false
false
false
false
false
let va_quick_MemStore64 (h: va_operand_heaplet) (src base: va_operand_reg_opr) (offset: int) (t: taint) (b: buffer64) (index: int) : (va_quickCode unit (va_code_MemStore64 h src base offset t)) =
(va_QProc (va_code_MemStore64 h src base offset t) ([va_Mod_mem; va_mod_heaplet h]) (va_wp_MemStore64 h src base offset t b index) (va_wpProof_MemStore64 h src base offset t b index))
false
EverCrypt.HMAC.fst
EverCrypt.HMAC.compute_sha1
val compute_sha1: compute_st SHA1
val compute_sha1: compute_st SHA1
let compute_sha1 = let open Hacl.Hash.SHA1 in mk_compute (|SHA1, ()|) hash_oneshot alloca init update_multi update_last finish
{ "file_name": "providers/evercrypt/fst/EverCrypt.HMAC.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 82, "end_line": 57, "start_col": 0, "start_line": 55 }
(* Agile HMAC *) module EverCrypt.HMAC open Hacl.HMAC // EverCrypt.Hash.Incremental.hash_256 is marked as private, so it is // inaccessible from here. Furthermore, the EverCrypt.Hash.Incremental module // does not have an interface, meaning that we can't even friend it! Writing an // interface for EverCrypt.Hash.Incremental is possible, but doesn't make much // sense: instantiations of the functor offer, by construction, an abstract // interface. Fortunately, we can use tactics to stealthily gain access to a // private definition that F* normally won't let us access. let super_hack () = let open FStar.Tactics in let hash_256 = [ "EverCrypt"; "Hash"; "Incremental"; "hash_256"] in let hash_256 = FStar.Tactics.pack_fv hash_256 in let hash_256 = pack (Tv_FVar hash_256) in let fv = pack_fv (cur_module () `FStar.List.Tot.append` [ "hash_256" ]) in let t: term = pack Tv_Unknown in let se = pack_sigelt (Sg_Let false [ pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = t; lb_def = hash_256 }) ]) in [ se ] %splice[hash_256] (super_hack ()) // Due to the hack above, the dependency arrow is invisible to the F* // parser/lexer, so we add an explicit dependency edge to avoid build errors. module Useless = EverCrypt.Hash.Incremental /// Four monomorphized variants, for callers who already know which algorithm they want (** @type: true *) val compute_sha1: compute_st SHA1 (** @type: true *) val compute_sha2_256: compute_st SHA2_256 (** @type: true *) val compute_sha2_384: compute_st SHA2_384 (** @type: true *) val compute_sha2_512: compute_st SHA2_512 (** @type: true *) val compute_blake2s: compute_st Blake2S (** @type: true *) val compute_blake2b: compute_st Blake2B
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Streaming.SHA2.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "Hacl.HMAC.fsti.checked", "Hacl.Hash.SHA2.fsti.checked", "Hacl.Hash.SHA1.fsti.checked", "Hacl.Hash.Blake2s_32.fsti.checked", "Hacl.Hash.Blake2b_32.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.Incremental.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.HMAC.fst" }
[ { "abbrev": true, "full_module": "EverCrypt.Hash.Incremental", "short_module": "Useless" }, { "abbrev": false, "full_module": "Hacl.HMAC", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.HMAC", "short_module": null }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": 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.HMAC.compute_st Spec.Hash.Definitions.SHA1
Prims.Tot
[ "total" ]
[]
[ "Hacl.HMAC.mk_compute", "Prims.Mkdtuple2", "Spec.Hash.Definitions.hash_alg", "Hacl.Hash.Definitions.m_spec", "Spec.Hash.Definitions.SHA1", "Hacl.Hash.SHA1.hash_oneshot", "Hacl.Hash.Core.SHA1.alloca", "Hacl.Hash.Core.SHA1.init", "Hacl.Hash.SHA1.update_multi", "Hacl.Hash.SHA1.update_last", "Hacl.Hash.Core.SHA1.finish" ]
[]
false
false
false
true
false
let compute_sha1 =
let open Hacl.Hash.SHA1 in mk_compute (| SHA1, () |) hash_oneshot alloca init update_multi update_last finish
false
Spec.Ed25519.Test.fst
Spec.Ed25519.Test.test4_msg
val test4_msg:lbytes 1023
val test4_msg:lbytes 1023
let test4_msg : lbytes 1023 = let l = List.Tot.map u8_from_UInt8 [ 0x08uy; 0xb8uy; 0xb2uy; 0xb7uy; 0x33uy; 0x42uy; 0x42uy; 0x43uy; 0x76uy; 0x0fuy; 0xe4uy; 0x26uy; 0xa4uy; 0xb5uy; 0x49uy; 0x08uy; 0x63uy; 0x21uy; 0x10uy; 0xa6uy; 0x6cuy; 0x2fuy; 0x65uy; 0x91uy; 0xeauy; 0xbduy; 0x33uy; 0x45uy; 0xe3uy; 0xe4uy; 0xebuy; 0x98uy; 0xfauy; 0x6euy; 0x26uy; 0x4buy; 0xf0uy; 0x9euy; 0xfeuy; 0x12uy; 0xeeuy; 0x50uy; 0xf8uy; 0xf5uy; 0x4euy; 0x9fuy; 0x77uy; 0xb1uy; 0xe3uy; 0x55uy; 0xf6uy; 0xc5uy; 0x05uy; 0x44uy; 0xe2uy; 0x3fuy; 0xb1uy; 0x43uy; 0x3duy; 0xdfuy; 0x73uy; 0xbeuy; 0x84uy; 0xd8uy; 0x79uy; 0xdeuy; 0x7cuy; 0x00uy; 0x46uy; 0xdcuy; 0x49uy; 0x96uy; 0xd9uy; 0xe7uy; 0x73uy; 0xf4uy; 0xbcuy; 0x9euy; 0xfeuy; 0x57uy; 0x38uy; 0x82uy; 0x9auy; 0xdbuy; 0x26uy; 0xc8uy; 0x1buy; 0x37uy; 0xc9uy; 0x3auy; 0x1buy; 0x27uy; 0x0buy; 0x20uy; 0x32uy; 0x9duy; 0x65uy; 0x86uy; 0x75uy; 0xfcuy; 0x6euy; 0xa5uy; 0x34uy; 0xe0uy; 0x81uy; 0x0auy; 0x44uy; 0x32uy; 0x82uy; 0x6buy; 0xf5uy; 0x8cuy; 0x94uy; 0x1euy; 0xfbuy; 0x65uy; 0xd5uy; 0x7auy; 0x33uy; 0x8buy; 0xbduy; 0x2euy; 0x26uy; 0x64uy; 0x0fuy; 0x89uy; 0xffuy; 0xbcuy; 0x1auy; 0x85uy; 0x8euy; 0xfcuy; 0xb8uy; 0x55uy; 0x0euy; 0xe3uy; 0xa5uy; 0xe1uy; 0x99uy; 0x8buy; 0xd1uy; 0x77uy; 0xe9uy; 0x3auy; 0x73uy; 0x63uy; 0xc3uy; 0x44uy; 0xfeuy; 0x6buy; 0x19uy; 0x9euy; 0xe5uy; 0xd0uy; 0x2euy; 0x82uy; 0xd5uy; 0x22uy; 0xc4uy; 0xfeuy; 0xbauy; 0x15uy; 0x45uy; 0x2fuy; 0x80uy; 0x28uy; 0x8auy; 0x82uy; 0x1auy; 0x57uy; 0x91uy; 0x16uy; 0xecuy; 0x6duy; 0xaduy; 0x2buy; 0x3buy; 0x31uy; 0x0duy; 0xa9uy; 0x03uy; 0x40uy; 0x1auy; 0xa6uy; 0x21uy; 0x00uy; 0xabuy; 0x5duy; 0x1auy; 0x36uy; 0x55uy; 0x3euy; 0x06uy; 0x20uy; 0x3buy; 0x33uy; 0x89uy; 0x0cuy; 0xc9uy; 0xb8uy; 0x32uy; 0xf7uy; 0x9euy; 0xf8uy; 0x05uy; 0x60uy; 0xccuy; 0xb9uy; 0xa3uy; 0x9cuy; 0xe7uy; 0x67uy; 0x96uy; 0x7euy; 0xd6uy; 0x28uy; 0xc6uy; 0xaduy; 0x57uy; 0x3cuy; 0xb1uy; 0x16uy; 0xdbuy; 0xefuy; 0xefuy; 0xd7uy; 0x54uy; 0x99uy; 0xdauy; 0x96uy; 0xbduy; 0x68uy; 0xa8uy; 0xa9uy; 0x7buy; 0x92uy; 0x8auy; 0x8buy; 0xbcuy; 0x10uy; 0x3buy; 0x66uy; 0x21uy; 0xfcuy; 0xdeuy; 0x2buy; 0xecuy; 0xa1uy; 0x23uy; 0x1duy; 0x20uy; 0x6buy; 0xe6uy; 0xcduy; 0x9euy; 0xc7uy; 0xafuy; 0xf6uy; 0xf6uy; 0xc9uy; 0x4fuy; 0xcduy; 0x72uy; 0x04uy; 0xeduy; 0x34uy; 0x55uy; 0xc6uy; 0x8cuy; 0x83uy; 0xf4uy; 0xa4uy; 0x1duy; 0xa4uy; 0xafuy; 0x2buy; 0x74uy; 0xefuy; 0x5cuy; 0x53uy; 0xf1uy; 0xd8uy; 0xacuy; 0x70uy; 0xbduy; 0xcbuy; 0x7euy; 0xd1uy; 0x85uy; 0xceuy; 0x81uy; 0xbduy; 0x84uy; 0x35uy; 0x9duy; 0x44uy; 0x25uy; 0x4duy; 0x95uy; 0x62uy; 0x9euy; 0x98uy; 0x55uy; 0xa9uy; 0x4auy; 0x7cuy; 0x19uy; 0x58uy; 0xd1uy; 0xf8uy; 0xaduy; 0xa5uy; 0xd0uy; 0x53uy; 0x2euy; 0xd8uy; 0xa5uy; 0xaauy; 0x3fuy; 0xb2uy; 0xd1uy; 0x7buy; 0xa7uy; 0x0euy; 0xb6uy; 0x24uy; 0x8euy; 0x59uy; 0x4euy; 0x1auy; 0x22uy; 0x97uy; 0xacuy; 0xbbuy; 0xb3uy; 0x9duy; 0x50uy; 0x2fuy; 0x1auy; 0x8cuy; 0x6euy; 0xb6uy; 0xf1uy; 0xceuy; 0x22uy; 0xb3uy; 0xdeuy; 0x1auy; 0x1fuy; 0x40uy; 0xccuy; 0x24uy; 0x55uy; 0x41uy; 0x19uy; 0xa8uy; 0x31uy; 0xa9uy; 0xaauy; 0xd6uy; 0x07uy; 0x9cuy; 0xaduy; 0x88uy; 0x42uy; 0x5duy; 0xe6uy; 0xbduy; 0xe1uy; 0xa9uy; 0x18uy; 0x7euy; 0xbbuy; 0x60uy; 0x92uy; 0xcfuy; 0x67uy; 0xbfuy; 0x2buy; 0x13uy; 0xfduy; 0x65uy; 0xf2uy; 0x70uy; 0x88uy; 0xd7uy; 0x8buy; 0x7euy; 0x88uy; 0x3cuy; 0x87uy; 0x59uy; 0xd2uy; 0xc4uy; 0xf5uy; 0xc6uy; 0x5auy; 0xdbuy; 0x75uy; 0x53uy; 0x87uy; 0x8auy; 0xd5uy; 0x75uy; 0xf9uy; 0xfauy; 0xd8uy; 0x78uy; 0xe8uy; 0x0auy; 0x0cuy; 0x9buy; 0xa6uy; 0x3buy; 0xcbuy; 0xccuy; 0x27uy; 0x32uy; 0xe6uy; 0x94uy; 0x85uy; 0xbbuy; 0xc9uy; 0xc9uy; 0x0buy; 0xfbuy; 0xd6uy; 0x24uy; 0x81uy; 0xd9uy; 0x08uy; 0x9buy; 0xecuy; 0xcfuy; 0x80uy; 0xcfuy; 0xe2uy; 0xdfuy; 0x16uy; 0xa2uy; 0xcfuy; 0x65uy; 0xbduy; 0x92uy; 0xdduy; 0x59uy; 0x7buy; 0x07uy; 0x07uy; 0xe0uy; 0x91uy; 0x7auy; 0xf4uy; 0x8buy; 0xbbuy; 0x75uy; 0xfeuy; 0xd4uy; 0x13uy; 0xd2uy; 0x38uy; 0xf5uy; 0x55uy; 0x5auy; 0x7auy; 0x56uy; 0x9duy; 0x80uy; 0xc3uy; 0x41uy; 0x4auy; 0x8duy; 0x08uy; 0x59uy; 0xdcuy; 0x65uy; 0xa4uy; 0x61uy; 0x28uy; 0xbauy; 0xb2uy; 0x7auy; 0xf8uy; 0x7auy; 0x71uy; 0x31uy; 0x4fuy; 0x31uy; 0x8cuy; 0x78uy; 0x2buy; 0x23uy; 0xebuy; 0xfeuy; 0x80uy; 0x8buy; 0x82uy; 0xb0uy; 0xceuy; 0x26uy; 0x40uy; 0x1duy; 0x2euy; 0x22uy; 0xf0uy; 0x4duy; 0x83uy; 0xd1uy; 0x25uy; 0x5duy; 0xc5uy; 0x1auy; 0xdduy; 0xd3uy; 0xb7uy; 0x5auy; 0x2buy; 0x1auy; 0xe0uy; 0x78uy; 0x45uy; 0x04uy; 0xdfuy; 0x54uy; 0x3auy; 0xf8uy; 0x96uy; 0x9buy; 0xe3uy; 0xeauy; 0x70uy; 0x82uy; 0xffuy; 0x7fuy; 0xc9uy; 0x88uy; 0x8cuy; 0x14uy; 0x4duy; 0xa2uy; 0xafuy; 0x58uy; 0x42uy; 0x9euy; 0xc9uy; 0x60uy; 0x31uy; 0xdbuy; 0xcauy; 0xd3uy; 0xdauy; 0xd9uy; 0xafuy; 0x0duy; 0xcbuy; 0xaauy; 0xafuy; 0x26uy; 0x8cuy; 0xb8uy; 0xfcuy; 0xffuy; 0xeauy; 0xd9uy; 0x4fuy; 0x3cuy; 0x7cuy; 0xa4uy; 0x95uy; 0xe0uy; 0x56uy; 0xa9uy; 0xb4uy; 0x7auy; 0xcduy; 0xb7uy; 0x51uy; 0xfbuy; 0x73uy; 0xe6uy; 0x66uy; 0xc6uy; 0xc6uy; 0x55uy; 0xaduy; 0xe8uy; 0x29uy; 0x72uy; 0x97uy; 0xd0uy; 0x7auy; 0xd1uy; 0xbauy; 0x5euy; 0x43uy; 0xf1uy; 0xbcuy; 0xa3uy; 0x23uy; 0x01uy; 0x65uy; 0x13uy; 0x39uy; 0xe2uy; 0x29uy; 0x04uy; 0xccuy; 0x8cuy; 0x42uy; 0xf5uy; 0x8cuy; 0x30uy; 0xc0uy; 0x4auy; 0xafuy; 0xdbuy; 0x03uy; 0x8duy; 0xdauy; 0x08uy; 0x47uy; 0xdduy; 0x98uy; 0x8duy; 0xcduy; 0xa6uy; 0xf3uy; 0xbfuy; 0xd1uy; 0x5cuy; 0x4buy; 0x4cuy; 0x45uy; 0x25uy; 0x00uy; 0x4auy; 0xa0uy; 0x6euy; 0xefuy; 0xf8uy; 0xcauy; 0x61uy; 0x78uy; 0x3auy; 0xacuy; 0xecuy; 0x57uy; 0xfbuy; 0x3duy; 0x1fuy; 0x92uy; 0xb0uy; 0xfeuy; 0x2fuy; 0xd1uy; 0xa8uy; 0x5fuy; 0x67uy; 0x24uy; 0x51uy; 0x7buy; 0x65uy; 0xe6uy; 0x14uy; 0xaduy; 0x68uy; 0x08uy; 0xd6uy; 0xf6uy; 0xeeuy; 0x34uy; 0xdfuy; 0xf7uy; 0x31uy; 0x0fuy; 0xdcuy; 0x82uy; 0xaeuy; 0xbfuy; 0xd9uy; 0x04uy; 0xb0uy; 0x1euy; 0x1duy; 0xc5uy; 0x4buy; 0x29uy; 0x27uy; 0x09uy; 0x4buy; 0x2duy; 0xb6uy; 0x8duy; 0x6fuy; 0x90uy; 0x3buy; 0x68uy; 0x40uy; 0x1auy; 0xdeuy; 0xbfuy; 0x5auy; 0x7euy; 0x08uy; 0xd7uy; 0x8fuy; 0xf4uy; 0xefuy; 0x5duy; 0x63uy; 0x65uy; 0x3auy; 0x65uy; 0x04uy; 0x0cuy; 0xf9uy; 0xbfuy; 0xd4uy; 0xacuy; 0xa7uy; 0x98uy; 0x4auy; 0x74uy; 0xd3uy; 0x71uy; 0x45uy; 0x98uy; 0x67uy; 0x80uy; 0xfcuy; 0x0buy; 0x16uy; 0xacuy; 0x45uy; 0x16uy; 0x49uy; 0xdeuy; 0x61uy; 0x88uy; 0xa7uy; 0xdbuy; 0xdfuy; 0x19uy; 0x1fuy; 0x64uy; 0xb5uy; 0xfcuy; 0x5euy; 0x2auy; 0xb4uy; 0x7buy; 0x57uy; 0xf7uy; 0xf7uy; 0x27uy; 0x6cuy; 0xd4uy; 0x19uy; 0xc1uy; 0x7auy; 0x3cuy; 0xa8uy; 0xe1uy; 0xb9uy; 0x39uy; 0xaeuy; 0x49uy; 0xe4uy; 0x88uy; 0xacuy; 0xbauy; 0x6buy; 0x96uy; 0x56uy; 0x10uy; 0xb5uy; 0x48uy; 0x01uy; 0x09uy; 0xc8uy; 0xb1uy; 0x7buy; 0x80uy; 0xe1uy; 0xb7uy; 0xb7uy; 0x50uy; 0xdfuy; 0xc7uy; 0x59uy; 0x8duy; 0x5duy; 0x50uy; 0x11uy; 0xfduy; 0x2duy; 0xccuy; 0x56uy; 0x00uy; 0xa3uy; 0x2euy; 0xf5uy; 0xb5uy; 0x2auy; 0x1euy; 0xccuy; 0x82uy; 0x0euy; 0x30uy; 0x8auy; 0xa3uy; 0x42uy; 0x72uy; 0x1auy; 0xacuy; 0x09uy; 0x43uy; 0xbfuy; 0x66uy; 0x86uy; 0xb6uy; 0x4buy; 0x25uy; 0x79uy; 0x37uy; 0x65uy; 0x04uy; 0xccuy; 0xc4uy; 0x93uy; 0xd9uy; 0x7euy; 0x6auy; 0xeduy; 0x3fuy; 0xb0uy; 0xf9uy; 0xcduy; 0x71uy; 0xa4uy; 0x3duy; 0xd4uy; 0x97uy; 0xf0uy; 0x1fuy; 0x17uy; 0xc0uy; 0xe2uy; 0xcbuy; 0x37uy; 0x97uy; 0xaauy; 0x2auy; 0x2fuy; 0x25uy; 0x66uy; 0x56uy; 0x16uy; 0x8euy; 0x6cuy; 0x49uy; 0x6auy; 0xfcuy; 0x5fuy; 0xb9uy; 0x32uy; 0x46uy; 0xf6uy; 0xb1uy; 0x11uy; 0x63uy; 0x98uy; 0xa3uy; 0x46uy; 0xf1uy; 0xa6uy; 0x41uy; 0xf3uy; 0xb0uy; 0x41uy; 0xe9uy; 0x89uy; 0xf7uy; 0x91uy; 0x4fuy; 0x90uy; 0xccuy; 0x2cuy; 0x7fuy; 0xffuy; 0x35uy; 0x78uy; 0x76uy; 0xe5uy; 0x06uy; 0xb5uy; 0x0duy; 0x33uy; 0x4buy; 0xa7uy; 0x7cuy; 0x22uy; 0x5buy; 0xc3uy; 0x07uy; 0xbauy; 0x53uy; 0x71uy; 0x52uy; 0xf3uy; 0xf1uy; 0x61uy; 0x0euy; 0x4euy; 0xafuy; 0xe5uy; 0x95uy; 0xf6uy; 0xd9uy; 0xd9uy; 0x0duy; 0x11uy; 0xfauy; 0xa9uy; 0x33uy; 0xa1uy; 0x5euy; 0xf1uy; 0x36uy; 0x95uy; 0x46uy; 0x86uy; 0x8auy; 0x7fuy; 0x3auy; 0x45uy; 0xa9uy; 0x67uy; 0x68uy; 0xd4uy; 0x0fuy; 0xd9uy; 0xd0uy; 0x34uy; 0x12uy; 0xc0uy; 0x91uy; 0xc6uy; 0x31uy; 0x5cuy; 0xf4uy; 0xfduy; 0xe7uy; 0xcbuy; 0x68uy; 0x60uy; 0x69uy; 0x37uy; 0x38uy; 0x0duy; 0xb2uy; 0xeauy; 0xaauy; 0x70uy; 0x7buy; 0x4cuy; 0x41uy; 0x85uy; 0xc3uy; 0x2euy; 0xdduy; 0xcduy; 0xd3uy; 0x06uy; 0x70uy; 0x5euy; 0x4duy; 0xc1uy; 0xffuy; 0xc8uy; 0x72uy; 0xeeuy; 0xeeuy; 0x47uy; 0x5auy; 0x64uy; 0xdfuy; 0xacuy; 0x86uy; 0xabuy; 0xa4uy; 0x1cuy; 0x06uy; 0x18uy; 0x98uy; 0x3fuy; 0x87uy; 0x41uy; 0xc5uy; 0xefuy; 0x68uy; 0xd3uy; 0xa1uy; 0x01uy; 0xe8uy; 0xa3uy; 0xb8uy; 0xcauy; 0xc6uy; 0x0cuy; 0x90uy; 0x5cuy; 0x15uy; 0xfcuy; 0x91uy; 0x08uy; 0x40uy; 0xb9uy; 0x4cuy; 0x00uy; 0xa0uy; 0xb9uy; 0xd0uy ] in assert_norm (List.Tot.length l == 1023); of_list l
{ "file_name": "specs/tests/Spec.Ed25519.Test.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 11, "end_line": 305, "start_col": 0, "start_line": 173 }
module Spec.Ed25519.Test open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module PS = Lib.PrintSequence open Spec.Ed25519 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" /// Test 1 let test1_sk : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x9duy; 0x61uy; 0xb1uy; 0x9duy; 0xefuy; 0xfduy; 0x5auy; 0x60uy; 0xbauy; 0x84uy; 0x4auy; 0xf4uy; 0x92uy; 0xecuy; 0x2cuy; 0xc4uy; 0x44uy; 0x49uy; 0xc5uy; 0x69uy; 0x7buy; 0x32uy; 0x69uy; 0x19uy; 0x70uy; 0x3buy; 0xacuy; 0x03uy; 0x1cuy; 0xaeuy; 0x7fuy; 0x60uy ] in assert_norm (List.Tot.length l == 32); of_list l let test1_pk : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0xd7uy; 0x5auy; 0x98uy; 0x01uy; 0x82uy; 0xb1uy; 0x0auy; 0xb7uy; 0xd5uy; 0x4buy; 0xfeuy; 0xd3uy; 0xc9uy; 0x64uy; 0x07uy; 0x3auy; 0x0euy; 0xe1uy; 0x72uy; 0xf3uy; 0xdauy; 0xa6uy; 0x23uy; 0x25uy; 0xafuy; 0x02uy; 0x1auy; 0x68uy; 0xf7uy; 0x07uy; 0x51uy; 0x1auy ] in assert_norm (List.Tot.length l == 32); of_list l let test1_msg : lbytes 0 = let l = List.Tot.map u8_from_UInt8 [] in assert_norm (List.Tot.length l == 0); of_list l let test1_expected_sig : lbytes 64 = let l = List.Tot.map u8_from_UInt8 [ 0xe5uy; 0x56uy; 0x43uy; 0x00uy; 0xc3uy; 0x60uy; 0xacuy; 0x72uy; 0x90uy; 0x86uy; 0xe2uy; 0xccuy; 0x80uy; 0x6euy; 0x82uy; 0x8auy; 0x84uy; 0x87uy; 0x7fuy; 0x1euy; 0xb8uy; 0xe5uy; 0xd9uy; 0x74uy; 0xd8uy; 0x73uy; 0xe0uy; 0x65uy; 0x22uy; 0x49uy; 0x01uy; 0x55uy; 0x5fuy; 0xb8uy; 0x82uy; 0x15uy; 0x90uy; 0xa3uy; 0x3buy; 0xacuy; 0xc6uy; 0x1euy; 0x39uy; 0x70uy; 0x1cuy; 0xf9uy; 0xb4uy; 0x6buy; 0xd2uy; 0x5buy; 0xf5uy; 0xf0uy; 0x59uy; 0x5buy; 0xbeuy; 0x24uy; 0x65uy; 0x51uy; 0x41uy; 0x43uy; 0x8euy; 0x7auy; 0x10uy; 0x0buy ] in assert_norm (List.Tot.length l == 64); of_list l /// Test 2 let test2_sk : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x4cuy; 0xcduy; 0x08uy; 0x9buy; 0x28uy; 0xffuy; 0x96uy; 0xdauy; 0x9duy; 0xb6uy; 0xc3uy; 0x46uy; 0xecuy; 0x11uy; 0x4euy; 0x0fuy; 0x5buy; 0x8auy; 0x31uy; 0x9fuy; 0x35uy; 0xabuy; 0xa6uy; 0x24uy; 0xdauy; 0x8cuy; 0xf6uy; 0xeduy; 0x4fuy; 0xb8uy; 0xa6uy; 0xfbuy ] in assert_norm (List.Tot.length l == 32); of_list l let test2_pk : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x3duy; 0x40uy; 0x17uy; 0xc3uy; 0xe8uy; 0x43uy; 0x89uy; 0x5auy; 0x92uy; 0xb7uy; 0x0auy; 0xa7uy; 0x4duy; 0x1buy; 0x7euy; 0xbcuy; 0x9cuy; 0x98uy; 0x2cuy; 0xcfuy; 0x2euy; 0xc4uy; 0x96uy; 0x8cuy; 0xc0uy; 0xcduy; 0x55uy; 0xf1uy; 0x2auy; 0xf4uy; 0x66uy; 0x0cuy ] in assert_norm (List.Tot.length l == 32); of_list l let test2_msg : lbytes 1 = let l = List.Tot.map u8_from_UInt8 [ 0x72uy ] in assert_norm (List.Tot.length l == 1); of_list l let test2_expected_sig : lbytes 64 = let l = List.Tot.map u8_from_UInt8 [ 0x92uy; 0xa0uy; 0x09uy; 0xa9uy; 0xf0uy; 0xd4uy; 0xcauy; 0xb8uy; 0x72uy; 0x0euy; 0x82uy; 0x0buy; 0x5fuy; 0x64uy; 0x25uy; 0x40uy; 0xa2uy; 0xb2uy; 0x7buy; 0x54uy; 0x16uy; 0x50uy; 0x3fuy; 0x8fuy; 0xb3uy; 0x76uy; 0x22uy; 0x23uy; 0xebuy; 0xdbuy; 0x69uy; 0xdauy; 0x08uy; 0x5auy; 0xc1uy; 0xe4uy; 0x3euy; 0x15uy; 0x99uy; 0x6euy; 0x45uy; 0x8fuy; 0x36uy; 0x13uy; 0xd0uy; 0xf1uy; 0x1duy; 0x8cuy; 0x38uy; 0x7buy; 0x2euy; 0xaeuy; 0xb4uy; 0x30uy; 0x2auy; 0xeeuy; 0xb0uy; 0x0duy; 0x29uy; 0x16uy; 0x12uy; 0xbbuy; 0x0cuy; 0x00uy ] in assert_norm (List.Tot.length l == 64); of_list l /// Test 3 let test3_sk : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0xc5uy; 0xaauy; 0x8duy; 0xf4uy; 0x3fuy; 0x9fuy; 0x83uy; 0x7buy; 0xeduy; 0xb7uy; 0x44uy; 0x2fuy; 0x31uy; 0xdcuy; 0xb7uy; 0xb1uy; 0x66uy; 0xd3uy; 0x85uy; 0x35uy; 0x07uy; 0x6fuy; 0x09uy; 0x4buy; 0x85uy; 0xceuy; 0x3auy; 0x2euy; 0x0buy; 0x44uy; 0x58uy; 0xf7uy ] in assert_norm (List.Tot.length l == 32); of_list l let test3_pk : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0xfcuy; 0x51uy; 0xcduy; 0x8euy; 0x62uy; 0x18uy; 0xa1uy; 0xa3uy; 0x8duy; 0xa4uy; 0x7euy; 0xd0uy; 0x02uy; 0x30uy; 0xf0uy; 0x58uy; 0x08uy; 0x16uy; 0xeduy; 0x13uy; 0xbauy; 0x33uy; 0x03uy; 0xacuy; 0x5duy; 0xebuy; 0x91uy; 0x15uy; 0x48uy; 0x90uy; 0x80uy; 0x25uy ] in assert_norm (List.Tot.length l == 32); of_list l let test3_msg : lbytes 2 = let l = List.Tot.map u8_from_UInt8 [ 0xafuy; 0x82uy ] in assert_norm (List.Tot.length l == 2); of_list l let test3_expected_sig : lbytes 64 = let l = List.Tot.map u8_from_UInt8 [ 0x62uy; 0x91uy; 0xd6uy; 0x57uy; 0xdeuy; 0xecuy; 0x24uy; 0x02uy; 0x48uy; 0x27uy; 0xe6uy; 0x9cuy; 0x3auy; 0xbeuy; 0x01uy; 0xa3uy; 0x0cuy; 0xe5uy; 0x48uy; 0xa2uy; 0x84uy; 0x74uy; 0x3auy; 0x44uy; 0x5euy; 0x36uy; 0x80uy; 0xd7uy; 0xdbuy; 0x5auy; 0xc3uy; 0xacuy; 0x18uy; 0xffuy; 0x9buy; 0x53uy; 0x8duy; 0x16uy; 0xf2uy; 0x90uy; 0xaeuy; 0x67uy; 0xf7uy; 0x60uy; 0x98uy; 0x4duy; 0xc6uy; 0x59uy; 0x4auy; 0x7cuy; 0x15uy; 0xe9uy; 0x71uy; 0x6euy; 0xd2uy; 0x8duy; 0xc0uy; 0x27uy; 0xbeuy; 0xceuy; 0xeauy; 0x1euy; 0xc4uy; 0x0auy ] in assert_norm (List.Tot.length l == 64); of_list l /// Test 4 let test4_sk : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0xf5uy; 0xe5uy; 0x76uy; 0x7cuy; 0xf1uy; 0x53uy; 0x31uy; 0x95uy; 0x17uy; 0x63uy; 0x0fuy; 0x22uy; 0x68uy; 0x76uy; 0xb8uy; 0x6cuy; 0x81uy; 0x60uy; 0xccuy; 0x58uy; 0x3buy; 0xc0uy; 0x13uy; 0x74uy; 0x4cuy; 0x6buy; 0xf2uy; 0x55uy; 0xf5uy; 0xccuy; 0x0euy; 0xe5uy ] in assert_norm (List.Tot.length l == 32); of_list l let test4_pk : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x27uy; 0x81uy; 0x17uy; 0xfcuy; 0x14uy; 0x4cuy; 0x72uy; 0x34uy; 0x0fuy; 0x67uy; 0xd0uy; 0xf2uy; 0x31uy; 0x6euy; 0x83uy; 0x86uy; 0xceuy; 0xffuy; 0xbfuy; 0x2buy; 0x24uy; 0x28uy; 0xc9uy; 0xc5uy; 0x1fuy; 0xefuy; 0x7cuy; 0x59uy; 0x7fuy; 0x1duy; 0x42uy; 0x6euy ] in assert_norm (List.Tot.length l == 32); of_list l
{ "checked_file": "/", "dependencies": [ "Spec.Ed25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.PrintSequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.List.fst.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.Test.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519", "short_module": null }, { "abbrev": true, "full_module": "Lib.PrintSequence", "short_module": "PS" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Ed25519", "short_module": null }, { "abbrev": false, "full_module": "Spec.Ed25519", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 1023
Prims.Tot
[ "total" ]
[]
[ "Lib.Sequence.of_list", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "FStar.List.Tot.Base.length", "Prims.list", "FStar.List.Tot.Base.map", "FStar.UInt8.t", "Lib.RawIntTypes.u8_from_UInt8", "Prims.Cons", "FStar.UInt8.__uint_to_t", "Prims.Nil" ]
[]
false
false
false
false
false
let test4_msg:lbytes 1023 =
let l = List.Tot.map u8_from_UInt8 [ 0x08uy; 0xb8uy; 0xb2uy; 0xb7uy; 0x33uy; 0x42uy; 0x42uy; 0x43uy; 0x76uy; 0x0fuy; 0xe4uy; 0x26uy; 0xa4uy; 0xb5uy; 0x49uy; 0x08uy; 0x63uy; 0x21uy; 0x10uy; 0xa6uy; 0x6cuy; 0x2fuy; 0x65uy; 0x91uy; 0xeauy; 0xbduy; 0x33uy; 0x45uy; 0xe3uy; 0xe4uy; 0xebuy; 0x98uy; 0xfauy; 0x6euy; 0x26uy; 0x4buy; 0xf0uy; 0x9euy; 0xfeuy; 0x12uy; 0xeeuy; 0x50uy; 0xf8uy; 0xf5uy; 0x4euy; 0x9fuy; 0x77uy; 0xb1uy; 0xe3uy; 0x55uy; 0xf6uy; 0xc5uy; 0x05uy; 0x44uy; 0xe2uy; 0x3fuy; 0xb1uy; 0x43uy; 0x3duy; 0xdfuy; 0x73uy; 0xbeuy; 0x84uy; 0xd8uy; 0x79uy; 0xdeuy; 0x7cuy; 0x00uy; 0x46uy; 0xdcuy; 0x49uy; 0x96uy; 0xd9uy; 0xe7uy; 0x73uy; 0xf4uy; 0xbcuy; 0x9euy; 0xfeuy; 0x57uy; 0x38uy; 0x82uy; 0x9auy; 0xdbuy; 0x26uy; 0xc8uy; 0x1buy; 0x37uy; 0xc9uy; 0x3auy; 0x1buy; 0x27uy; 0x0buy; 0x20uy; 0x32uy; 0x9duy; 0x65uy; 0x86uy; 0x75uy; 0xfcuy; 0x6euy; 0xa5uy; 0x34uy; 0xe0uy; 0x81uy; 0x0auy; 0x44uy; 0x32uy; 0x82uy; 0x6buy; 0xf5uy; 0x8cuy; 0x94uy; 0x1euy; 0xfbuy; 0x65uy; 0xd5uy; 0x7auy; 0x33uy; 0x8buy; 0xbduy; 0x2euy; 0x26uy; 0x64uy; 0x0fuy; 0x89uy; 0xffuy; 0xbcuy; 0x1auy; 0x85uy; 0x8euy; 0xfcuy; 0xb8uy; 0x55uy; 0x0euy; 0xe3uy; 0xa5uy; 0xe1uy; 0x99uy; 0x8buy; 0xd1uy; 0x77uy; 0xe9uy; 0x3auy; 0x73uy; 0x63uy; 0xc3uy; 0x44uy; 0xfeuy; 0x6buy; 0x19uy; 0x9euy; 0xe5uy; 0xd0uy; 0x2euy; 0x82uy; 0xd5uy; 0x22uy; 0xc4uy; 0xfeuy; 0xbauy; 0x15uy; 0x45uy; 0x2fuy; 0x80uy; 0x28uy; 0x8auy; 0x82uy; 0x1auy; 0x57uy; 0x91uy; 0x16uy; 0xecuy; 0x6duy; 0xaduy; 0x2buy; 0x3buy; 0x31uy; 0x0duy; 0xa9uy; 0x03uy; 0x40uy; 0x1auy; 0xa6uy; 0x21uy; 0x00uy; 0xabuy; 0x5duy; 0x1auy; 0x36uy; 0x55uy; 0x3euy; 0x06uy; 0x20uy; 0x3buy; 0x33uy; 0x89uy; 0x0cuy; 0xc9uy; 0xb8uy; 0x32uy; 0xf7uy; 0x9euy; 0xf8uy; 0x05uy; 0x60uy; 0xccuy; 0xb9uy; 0xa3uy; 0x9cuy; 0xe7uy; 0x67uy; 0x96uy; 0x7euy; 0xd6uy; 0x28uy; 0xc6uy; 0xaduy; 0x57uy; 0x3cuy; 0xb1uy; 0x16uy; 0xdbuy; 0xefuy; 0xefuy; 0xd7uy; 0x54uy; 0x99uy; 0xdauy; 0x96uy; 0xbduy; 0x68uy; 0xa8uy; 0xa9uy; 0x7buy; 0x92uy; 0x8auy; 0x8buy; 0xbcuy; 0x10uy; 0x3buy; 0x66uy; 0x21uy; 0xfcuy; 0xdeuy; 0x2buy; 0xecuy; 0xa1uy; 0x23uy; 0x1duy; 0x20uy; 0x6buy; 0xe6uy; 0xcduy; 0x9euy; 0xc7uy; 0xafuy; 0xf6uy; 0xf6uy; 0xc9uy; 0x4fuy; 0xcduy; 0x72uy; 0x04uy; 0xeduy; 0x34uy; 0x55uy; 0xc6uy; 0x8cuy; 0x83uy; 0xf4uy; 0xa4uy; 0x1duy; 0xa4uy; 0xafuy; 0x2buy; 0x74uy; 0xefuy; 0x5cuy; 0x53uy; 0xf1uy; 0xd8uy; 0xacuy; 0x70uy; 0xbduy; 0xcbuy; 0x7euy; 0xd1uy; 0x85uy; 0xceuy; 0x81uy; 0xbduy; 0x84uy; 0x35uy; 0x9duy; 0x44uy; 0x25uy; 0x4duy; 0x95uy; 0x62uy; 0x9euy; 0x98uy; 0x55uy; 0xa9uy; 0x4auy; 0x7cuy; 0x19uy; 0x58uy; 0xd1uy; 0xf8uy; 0xaduy; 0xa5uy; 0xd0uy; 0x53uy; 0x2euy; 0xd8uy; 0xa5uy; 0xaauy; 0x3fuy; 0xb2uy; 0xd1uy; 0x7buy; 0xa7uy; 0x0euy; 0xb6uy; 0x24uy; 0x8euy; 0x59uy; 0x4euy; 0x1auy; 0x22uy; 0x97uy; 0xacuy; 0xbbuy; 0xb3uy; 0x9duy; 0x50uy; 0x2fuy; 0x1auy; 0x8cuy; 0x6euy; 0xb6uy; 0xf1uy; 0xceuy; 0x22uy; 0xb3uy; 0xdeuy; 0x1auy; 0x1fuy; 0x40uy; 0xccuy; 0x24uy; 0x55uy; 0x41uy; 0x19uy; 0xa8uy; 0x31uy; 0xa9uy; 0xaauy; 0xd6uy; 0x07uy; 0x9cuy; 0xaduy; 0x88uy; 0x42uy; 0x5duy; 0xe6uy; 0xbduy; 0xe1uy; 0xa9uy; 0x18uy; 0x7euy; 0xbbuy; 0x60uy; 0x92uy; 0xcfuy; 0x67uy; 0xbfuy; 0x2buy; 0x13uy; 0xfduy; 0x65uy; 0xf2uy; 0x70uy; 0x88uy; 0xd7uy; 0x8buy; 0x7euy; 0x88uy; 0x3cuy; 0x87uy; 0x59uy; 0xd2uy; 0xc4uy; 0xf5uy; 0xc6uy; 0x5auy; 0xdbuy; 0x75uy; 0x53uy; 0x87uy; 0x8auy; 0xd5uy; 0x75uy; 0xf9uy; 0xfauy; 0xd8uy; 0x78uy; 0xe8uy; 0x0auy; 0x0cuy; 0x9buy; 0xa6uy; 0x3buy; 0xcbuy; 0xccuy; 0x27uy; 0x32uy; 0xe6uy; 0x94uy; 0x85uy; 0xbbuy; 0xc9uy; 0xc9uy; 0x0buy; 0xfbuy; 0xd6uy; 0x24uy; 0x81uy; 0xd9uy; 0x08uy; 0x9buy; 0xecuy; 0xcfuy; 0x80uy; 0xcfuy; 0xe2uy; 0xdfuy; 0x16uy; 0xa2uy; 0xcfuy; 0x65uy; 0xbduy; 0x92uy; 0xdduy; 0x59uy; 0x7buy; 0x07uy; 0x07uy; 0xe0uy; 0x91uy; 0x7auy; 0xf4uy; 0x8buy; 0xbbuy; 0x75uy; 0xfeuy; 0xd4uy; 0x13uy; 0xd2uy; 0x38uy; 0xf5uy; 0x55uy; 0x5auy; 0x7auy; 0x56uy; 0x9duy; 0x80uy; 0xc3uy; 0x41uy; 0x4auy; 0x8duy; 0x08uy; 0x59uy; 0xdcuy; 0x65uy; 0xa4uy; 0x61uy; 0x28uy; 0xbauy; 0xb2uy; 0x7auy; 0xf8uy; 0x7auy; 0x71uy; 0x31uy; 0x4fuy; 0x31uy; 0x8cuy; 0x78uy; 0x2buy; 0x23uy; 0xebuy; 0xfeuy; 0x80uy; 0x8buy; 0x82uy; 0xb0uy; 0xceuy; 0x26uy; 0x40uy; 0x1duy; 0x2euy; 0x22uy; 0xf0uy; 0x4duy; 0x83uy; 0xd1uy; 0x25uy; 0x5duy; 0xc5uy; 0x1auy; 0xdduy; 0xd3uy; 0xb7uy; 0x5auy; 0x2buy; 0x1auy; 0xe0uy; 0x78uy; 0x45uy; 0x04uy; 0xdfuy; 0x54uy; 0x3auy; 0xf8uy; 0x96uy; 0x9buy; 0xe3uy; 0xeauy; 0x70uy; 0x82uy; 0xffuy; 0x7fuy; 0xc9uy; 0x88uy; 0x8cuy; 0x14uy; 0x4duy; 0xa2uy; 0xafuy; 0x58uy; 0x42uy; 0x9euy; 0xc9uy; 0x60uy; 0x31uy; 0xdbuy; 0xcauy; 0xd3uy; 0xdauy; 0xd9uy; 0xafuy; 0x0duy; 0xcbuy; 0xaauy; 0xafuy; 0x26uy; 0x8cuy; 0xb8uy; 0xfcuy; 0xffuy; 0xeauy; 0xd9uy; 0x4fuy; 0x3cuy; 0x7cuy; 0xa4uy; 0x95uy; 0xe0uy; 0x56uy; 0xa9uy; 0xb4uy; 0x7auy; 0xcduy; 0xb7uy; 0x51uy; 0xfbuy; 0x73uy; 0xe6uy; 0x66uy; 0xc6uy; 0xc6uy; 0x55uy; 0xaduy; 0xe8uy; 0x29uy; 0x72uy; 0x97uy; 0xd0uy; 0x7auy; 0xd1uy; 0xbauy; 0x5euy; 0x43uy; 0xf1uy; 0xbcuy; 0xa3uy; 0x23uy; 0x01uy; 0x65uy; 0x13uy; 0x39uy; 0xe2uy; 0x29uy; 0x04uy; 0xccuy; 0x8cuy; 0x42uy; 0xf5uy; 0x8cuy; 0x30uy; 0xc0uy; 0x4auy; 0xafuy; 0xdbuy; 0x03uy; 0x8duy; 0xdauy; 0x08uy; 0x47uy; 0xdduy; 0x98uy; 0x8duy; 0xcduy; 0xa6uy; 0xf3uy; 0xbfuy; 0xd1uy; 0x5cuy; 0x4buy; 0x4cuy; 0x45uy; 0x25uy; 0x00uy; 0x4auy; 0xa0uy; 0x6euy; 0xefuy; 0xf8uy; 0xcauy; 0x61uy; 0x78uy; 0x3auy; 0xacuy; 0xecuy; 0x57uy; 0xfbuy; 0x3duy; 0x1fuy; 0x92uy; 0xb0uy; 0xfeuy; 0x2fuy; 0xd1uy; 0xa8uy; 0x5fuy; 0x67uy; 0x24uy; 0x51uy; 0x7buy; 0x65uy; 0xe6uy; 0x14uy; 0xaduy; 0x68uy; 0x08uy; 0xd6uy; 0xf6uy; 0xeeuy; 0x34uy; 0xdfuy; 0xf7uy; 0x31uy; 0x0fuy; 0xdcuy; 0x82uy; 0xaeuy; 0xbfuy; 0xd9uy; 0x04uy; 0xb0uy; 0x1euy; 0x1duy; 0xc5uy; 0x4buy; 0x29uy; 0x27uy; 0x09uy; 0x4buy; 0x2duy; 0xb6uy; 0x8duy; 0x6fuy; 0x90uy; 0x3buy; 0x68uy; 0x40uy; 0x1auy; 0xdeuy; 0xbfuy; 0x5auy; 0x7euy; 0x08uy; 0xd7uy; 0x8fuy; 0xf4uy; 0xefuy; 0x5duy; 0x63uy; 0x65uy; 0x3auy; 0x65uy; 0x04uy; 0x0cuy; 0xf9uy; 0xbfuy; 0xd4uy; 0xacuy; 0xa7uy; 0x98uy; 0x4auy; 0x74uy; 0xd3uy; 0x71uy; 0x45uy; 0x98uy; 0x67uy; 0x80uy; 0xfcuy; 0x0buy; 0x16uy; 0xacuy; 0x45uy; 0x16uy; 0x49uy; 0xdeuy; 0x61uy; 0x88uy; 0xa7uy; 0xdbuy; 0xdfuy; 0x19uy; 0x1fuy; 0x64uy; 0xb5uy; 0xfcuy; 0x5euy; 0x2auy; 0xb4uy; 0x7buy; 0x57uy; 0xf7uy; 0xf7uy; 0x27uy; 0x6cuy; 0xd4uy; 0x19uy; 0xc1uy; 0x7auy; 0x3cuy; 0xa8uy; 0xe1uy; 0xb9uy; 0x39uy; 0xaeuy; 0x49uy; 0xe4uy; 0x88uy; 0xacuy; 0xbauy; 0x6buy; 0x96uy; 0x56uy; 0x10uy; 0xb5uy; 0x48uy; 0x01uy; 0x09uy; 0xc8uy; 0xb1uy; 0x7buy; 0x80uy; 0xe1uy; 0xb7uy; 0xb7uy; 0x50uy; 0xdfuy; 0xc7uy; 0x59uy; 0x8duy; 0x5duy; 0x50uy; 0x11uy; 0xfduy; 0x2duy; 0xccuy; 0x56uy; 0x00uy; 0xa3uy; 0x2euy; 0xf5uy; 0xb5uy; 0x2auy; 0x1euy; 0xccuy; 0x82uy; 0x0euy; 0x30uy; 0x8auy; 0xa3uy; 0x42uy; 0x72uy; 0x1auy; 0xacuy; 0x09uy; 0x43uy; 0xbfuy; 0x66uy; 0x86uy; 0xb6uy; 0x4buy; 0x25uy; 0x79uy; 0x37uy; 0x65uy; 0x04uy; 0xccuy; 0xc4uy; 0x93uy; 0xd9uy; 0x7euy; 0x6auy; 0xeduy; 0x3fuy; 0xb0uy; 0xf9uy; 0xcduy; 0x71uy; 0xa4uy; 0x3duy; 0xd4uy; 0x97uy; 0xf0uy; 0x1fuy; 0x17uy; 0xc0uy; 0xe2uy; 0xcbuy; 0x37uy; 0x97uy; 0xaauy; 0x2auy; 0x2fuy; 0x25uy; 0x66uy; 0x56uy; 0x16uy; 0x8euy; 0x6cuy; 0x49uy; 0x6auy; 0xfcuy; 0x5fuy; 0xb9uy; 0x32uy; 0x46uy; 0xf6uy; 0xb1uy; 0x11uy; 0x63uy; 0x98uy; 0xa3uy; 0x46uy; 0xf1uy; 0xa6uy; 0x41uy; 0xf3uy; 0xb0uy; 0x41uy; 0xe9uy; 0x89uy; 0xf7uy; 0x91uy; 0x4fuy; 0x90uy; 0xccuy; 0x2cuy; 0x7fuy; 0xffuy; 0x35uy; 0x78uy; 0x76uy; 0xe5uy; 0x06uy; 0xb5uy; 0x0duy; 0x33uy; 0x4buy; 0xa7uy; 0x7cuy; 0x22uy; 0x5buy; 0xc3uy; 0x07uy; 0xbauy; 0x53uy; 0x71uy; 0x52uy; 0xf3uy; 0xf1uy; 0x61uy; 0x0euy; 0x4euy; 0xafuy; 0xe5uy; 0x95uy; 0xf6uy; 0xd9uy; 0xd9uy; 0x0duy; 0x11uy; 0xfauy; 0xa9uy; 0x33uy; 0xa1uy; 0x5euy; 0xf1uy; 0x36uy; 0x95uy; 0x46uy; 0x86uy; 0x8auy; 0x7fuy; 0x3auy; 0x45uy; 0xa9uy; 0x67uy; 0x68uy; 0xd4uy; 0x0fuy; 0xd9uy; 0xd0uy; 0x34uy; 0x12uy; 0xc0uy; 0x91uy; 0xc6uy; 0x31uy; 0x5cuy; 0xf4uy; 0xfduy; 0xe7uy; 0xcbuy; 0x68uy; 0x60uy; 0x69uy; 0x37uy; 0x38uy; 0x0duy; 0xb2uy; 0xeauy; 0xaauy; 0x70uy; 0x7buy; 0x4cuy; 0x41uy; 0x85uy; 0xc3uy; 0x2euy; 0xdduy; 0xcduy; 0xd3uy; 0x06uy; 0x70uy; 0x5euy; 0x4duy; 0xc1uy; 0xffuy; 0xc8uy; 0x72uy; 0xeeuy; 0xeeuy; 0x47uy; 0x5auy; 0x64uy; 0xdfuy; 0xacuy; 0x86uy; 0xabuy; 0xa4uy; 0x1cuy; 0x06uy; 0x18uy; 0x98uy; 0x3fuy; 0x87uy; 0x41uy; 0xc5uy; 0xefuy; 0x68uy; 0xd3uy; 0xa1uy; 0x01uy; 0xe8uy; 0xa3uy; 0xb8uy; 0xcauy; 0xc6uy; 0x0cuy; 0x90uy; 0x5cuy; 0x15uy; 0xfcuy; 0x91uy; 0x08uy; 0x40uy; 0xb9uy; 0x4cuy; 0x00uy; 0xa0uy; 0xb9uy; 0xd0uy ] in assert_norm (List.Tot.length l == 1023); of_list l
false
EverCrypt.HMAC.fst
EverCrypt.HMAC.compute_sha2_384
val compute_sha2_384: compute_st SHA2_384
val compute_sha2_384: compute_st SHA2_384
let compute_sha2_384 = let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (|SHA2_384, ()|) hash_384 alloca_384 init_384 update_multi_384 update_last_384 finish_384
{ "file_name": "providers/evercrypt/fst/EverCrypt.HMAC.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 39, "end_line": 72, "start_col": 0, "start_line": 68 }
(* Agile HMAC *) module EverCrypt.HMAC open Hacl.HMAC // EverCrypt.Hash.Incremental.hash_256 is marked as private, so it is // inaccessible from here. Furthermore, the EverCrypt.Hash.Incremental module // does not have an interface, meaning that we can't even friend it! Writing an // interface for EverCrypt.Hash.Incremental is possible, but doesn't make much // sense: instantiations of the functor offer, by construction, an abstract // interface. Fortunately, we can use tactics to stealthily gain access to a // private definition that F* normally won't let us access. let super_hack () = let open FStar.Tactics in let hash_256 = [ "EverCrypt"; "Hash"; "Incremental"; "hash_256"] in let hash_256 = FStar.Tactics.pack_fv hash_256 in let hash_256 = pack (Tv_FVar hash_256) in let fv = pack_fv (cur_module () `FStar.List.Tot.append` [ "hash_256" ]) in let t: term = pack Tv_Unknown in let se = pack_sigelt (Sg_Let false [ pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = t; lb_def = hash_256 }) ]) in [ se ] %splice[hash_256] (super_hack ()) // Due to the hack above, the dependency arrow is invisible to the F* // parser/lexer, so we add an explicit dependency edge to avoid build errors. module Useless = EverCrypt.Hash.Incremental /// Four monomorphized variants, for callers who already know which algorithm they want (** @type: true *) val compute_sha1: compute_st SHA1 (** @type: true *) val compute_sha2_256: compute_st SHA2_256 (** @type: true *) val compute_sha2_384: compute_st SHA2_384 (** @type: true *) val compute_sha2_512: compute_st SHA2_512 (** @type: true *) val compute_blake2s: compute_st Blake2S (** @type: true *) val compute_blake2b: compute_st Blake2B let compute_sha1 = let open Hacl.Hash.SHA1 in mk_compute (|SHA1, ()|) hash_oneshot alloca init update_multi update_last finish (* This implementation calls into EverCrypt.Hash, which multiplexes between Hacl and Vale implementations of SHA2_256 functions depending on the static configuration and CPUID *) let compute_sha2_256 = let open Hacl.Hash.SHA2 in mk_compute (|SHA2_256, ()|) hash_256 alloca_256 init_256 EverCrypt.Hash.update_multi_256 update_last_256 finish_256
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Streaming.SHA2.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "Hacl.HMAC.fsti.checked", "Hacl.Hash.SHA2.fsti.checked", "Hacl.Hash.SHA1.fsti.checked", "Hacl.Hash.Blake2s_32.fsti.checked", "Hacl.Hash.Blake2b_32.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.Incremental.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.HMAC.fst" }
[ { "abbrev": true, "full_module": "EverCrypt.Hash.Incremental", "short_module": "Useless" }, { "abbrev": false, "full_module": "Hacl.HMAC", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.HMAC", "short_module": null }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": 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.HMAC.compute_st Spec.Hash.Definitions.SHA2_384
Prims.Tot
[ "total" ]
[]
[ "Hacl.HMAC.mk_compute", "Prims.Mkdtuple2", "Spec.Hash.Definitions.hash_alg", "Hacl.Hash.Definitions.m_spec", "Spec.Hash.Definitions.SHA2_384", "Hacl.Streaming.SHA2.hash_384", "Hacl.Hash.SHA2.alloca_384", "Hacl.Hash.SHA2.init_384", "Hacl.Hash.SHA2.update_multi_384", "Hacl.Hash.SHA2.update_last_384", "Hacl.Hash.SHA2.finish_384" ]
[]
false
false
false
true
false
let compute_sha2_384 =
let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (| SHA2_384, () |) hash_384 alloca_384 init_384 update_multi_384 update_last_384 finish_384
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.alloca
val alloca : Hacl.Streaming.Functor.alloca_st Hacl.Streaming.MD5.hacl_md5 () (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
let alloca = F.alloca hacl_md5 () (state_t_md5.s ()) (G.erased unit)
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 68, "end_line": 36, "start_col": 0, "start_line": 36 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5 inline_for_extraction noextract let state_t_md5 = state_t MD5 /// Type abbreviation - for pretty code generation let state_t = Hacl.Streaming.MD.state_32
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Streaming.Functor.alloca_st Hacl.Streaming.MD5.hacl_md5 () (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.Functor.alloca", "Prims.unit", "Hacl.Streaming.MD5.hacl_md5", "Hacl.Streaming.Interface.__proj__Stateful__item__s", "Hacl.Streaming.MD5.state_t_md5", "FStar.Ghost.erased" ]
[]
false
false
false
false
false
let alloca =
F.alloca hacl_md5 () (state_t_md5.s ()) (G.erased unit)
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.malloc
val malloc : Hacl.Streaming.Functor.malloc_st Hacl.Streaming.MD5.hacl_md5 () (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
let malloc = F.malloc hacl_md5 () (state_t_md5.s ()) (G.erased unit)
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 68, "end_line": 37, "start_col": 0, "start_line": 37 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5 inline_for_extraction noextract let state_t_md5 = state_t MD5 /// Type abbreviation - for pretty code generation let state_t = Hacl.Streaming.MD.state_32 noextract
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Streaming.Functor.malloc_st Hacl.Streaming.MD5.hacl_md5 () (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.Functor.malloc", "Prims.unit", "Hacl.Streaming.MD5.hacl_md5", "Hacl.Streaming.Interface.__proj__Stateful__item__s", "Hacl.Streaming.MD5.state_t_md5", "FStar.Ghost.erased" ]
[]
false
false
false
false
false
let malloc =
F.malloc hacl_md5 () (state_t_md5.s ()) (G.erased unit)
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.hacl_md5
val hacl_md5 : Hacl.Streaming.Interface.block Prims.unit
let hacl_md5 = hacl_md MD5
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 26, "end_line": 27, "start_col": 0, "start_line": 27 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Streaming.Interface.block Prims.unit
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.MD.hacl_md", "Spec.Hash.Definitions.MD5" ]
[]
false
false
false
true
false
let hacl_md5 =
hacl_md MD5
false
EverCrypt.HMAC.fst
EverCrypt.HMAC.compute_blake2b
val compute_blake2b: compute_st Blake2B
val compute_blake2b: compute_st Blake2B
let compute_blake2b = let open Hacl.Hash.Blake2b_32 in mk_compute (|Blake2B, Hacl.Impl.Blake2.Core.M32|) hash alloca init update_multi update_last finish
{ "file_name": "providers/evercrypt/fst/EverCrypt.HMAC.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 88, "start_col": 0, "start_line": 85 }
(* Agile HMAC *) module EverCrypt.HMAC open Hacl.HMAC // EverCrypt.Hash.Incremental.hash_256 is marked as private, so it is // inaccessible from here. Furthermore, the EverCrypt.Hash.Incremental module // does not have an interface, meaning that we can't even friend it! Writing an // interface for EverCrypt.Hash.Incremental is possible, but doesn't make much // sense: instantiations of the functor offer, by construction, an abstract // interface. Fortunately, we can use tactics to stealthily gain access to a // private definition that F* normally won't let us access. let super_hack () = let open FStar.Tactics in let hash_256 = [ "EverCrypt"; "Hash"; "Incremental"; "hash_256"] in let hash_256 = FStar.Tactics.pack_fv hash_256 in let hash_256 = pack (Tv_FVar hash_256) in let fv = pack_fv (cur_module () `FStar.List.Tot.append` [ "hash_256" ]) in let t: term = pack Tv_Unknown in let se = pack_sigelt (Sg_Let false [ pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = t; lb_def = hash_256 }) ]) in [ se ] %splice[hash_256] (super_hack ()) // Due to the hack above, the dependency arrow is invisible to the F* // parser/lexer, so we add an explicit dependency edge to avoid build errors. module Useless = EverCrypt.Hash.Incremental /// Four monomorphized variants, for callers who already know which algorithm they want (** @type: true *) val compute_sha1: compute_st SHA1 (** @type: true *) val compute_sha2_256: compute_st SHA2_256 (** @type: true *) val compute_sha2_384: compute_st SHA2_384 (** @type: true *) val compute_sha2_512: compute_st SHA2_512 (** @type: true *) val compute_blake2s: compute_st Blake2S (** @type: true *) val compute_blake2b: compute_st Blake2B let compute_sha1 = let open Hacl.Hash.SHA1 in mk_compute (|SHA1, ()|) hash_oneshot alloca init update_multi update_last finish (* This implementation calls into EverCrypt.Hash, which multiplexes between Hacl and Vale implementations of SHA2_256 functions depending on the static configuration and CPUID *) let compute_sha2_256 = let open Hacl.Hash.SHA2 in mk_compute (|SHA2_256, ()|) hash_256 alloca_256 init_256 EverCrypt.Hash.update_multi_256 update_last_256 finish_256 let compute_sha2_384 = let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (|SHA2_384, ()|) hash_384 alloca_384 init_384 update_multi_384 update_last_384 finish_384 let compute_sha2_512 = let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (|SHA2_512, ()|) hash_512 alloca_512 init_512 update_multi_512 update_last_512 finish_512 let compute_blake2s = let open Hacl.Hash.Blake2s_32 in mk_compute (|Blake2S, Hacl.Impl.Blake2.Core.M32|) hash alloca init update_multi update_last finish
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Streaming.SHA2.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "Hacl.HMAC.fsti.checked", "Hacl.Hash.SHA2.fsti.checked", "Hacl.Hash.SHA1.fsti.checked", "Hacl.Hash.Blake2s_32.fsti.checked", "Hacl.Hash.Blake2b_32.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.Incremental.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.HMAC.fst" }
[ { "abbrev": true, "full_module": "EverCrypt.Hash.Incremental", "short_module": "Useless" }, { "abbrev": false, "full_module": "Hacl.HMAC", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.HMAC", "short_module": null }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": 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.HMAC.compute_st Spec.Hash.Definitions.Blake2B
Prims.Tot
[ "total" ]
[]
[ "Hacl.HMAC.mk_compute", "Prims.Mkdtuple2", "Spec.Hash.Definitions.hash_alg", "Hacl.Hash.Definitions.m_spec", "Spec.Hash.Definitions.Blake2B", "Hacl.Impl.Blake2.Core.M32", "Hacl.Hash.Blake2b_32.hash", "Hacl.Hash.Blake2b_32.alloca", "Hacl.Hash.Blake2b_32.init", "Hacl.Hash.Blake2b_32.update_multi", "Hacl.Hash.Blake2b_32.update_last", "Hacl.Hash.Blake2b_32.finish" ]
[]
false
false
false
true
false
let compute_blake2b =
let open Hacl.Hash.Blake2b_32 in mk_compute (| Blake2B, Hacl.Impl.Blake2.Core.M32 |) hash alloca init update_multi update_last finish
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.copy
val copy : Hacl.Streaming.Functor.copy_st Hacl.Streaming.MD5.hacl_md5 (FStar.Ghost.reveal (FStar.Ghost.hide ())) (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
let copy = F.copy hacl_md5 () (state_t_md5.s ()) (G.erased unit)
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 64, "end_line": 45, "start_col": 0, "start_line": 45 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5 inline_for_extraction noextract let state_t_md5 = state_t MD5 /// Type abbreviation - for pretty code generation let state_t = Hacl.Streaming.MD.state_32 noextract let alloca = F.alloca hacl_md5 () (state_t_md5.s ()) (G.erased unit) let malloc = F.malloc hacl_md5 () (state_t_md5.s ()) (G.erased unit) let reset = F.reset hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit) [@@ Comment "0 = success, 1 = max length exceeded" ] let update = F.update hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit) let digest = F.digest hacl_md5 () (state_t_md5.s ()) (G.erased unit) let free = F.free hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Streaming.Functor.copy_st Hacl.Streaming.MD5.hacl_md5 (FStar.Ghost.reveal (FStar.Ghost.hide ())) (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.Functor.copy", "Prims.unit", "Hacl.Streaming.MD5.hacl_md5", "FStar.Ghost.hide", "Hacl.Streaming.Interface.__proj__Stateful__item__s", "Hacl.Streaming.MD5.state_t_md5", "FStar.Ghost.erased" ]
[]
false
false
false
false
false
let copy =
F.copy hacl_md5 () (state_t_md5.s ()) (G.erased unit)
false
EverCrypt.HMAC.fst
EverCrypt.HMAC.compute_sha2_512
val compute_sha2_512: compute_st SHA2_512
val compute_sha2_512: compute_st SHA2_512
let compute_sha2_512 = let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (|SHA2_512, ()|) hash_512 alloca_512 init_512 update_multi_512 update_last_512 finish_512
{ "file_name": "providers/evercrypt/fst/EverCrypt.HMAC.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 39, "end_line": 78, "start_col": 0, "start_line": 74 }
(* Agile HMAC *) module EverCrypt.HMAC open Hacl.HMAC // EverCrypt.Hash.Incremental.hash_256 is marked as private, so it is // inaccessible from here. Furthermore, the EverCrypt.Hash.Incremental module // does not have an interface, meaning that we can't even friend it! Writing an // interface for EverCrypt.Hash.Incremental is possible, but doesn't make much // sense: instantiations of the functor offer, by construction, an abstract // interface. Fortunately, we can use tactics to stealthily gain access to a // private definition that F* normally won't let us access. let super_hack () = let open FStar.Tactics in let hash_256 = [ "EverCrypt"; "Hash"; "Incremental"; "hash_256"] in let hash_256 = FStar.Tactics.pack_fv hash_256 in let hash_256 = pack (Tv_FVar hash_256) in let fv = pack_fv (cur_module () `FStar.List.Tot.append` [ "hash_256" ]) in let t: term = pack Tv_Unknown in let se = pack_sigelt (Sg_Let false [ pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = t; lb_def = hash_256 }) ]) in [ se ] %splice[hash_256] (super_hack ()) // Due to the hack above, the dependency arrow is invisible to the F* // parser/lexer, so we add an explicit dependency edge to avoid build errors. module Useless = EverCrypt.Hash.Incremental /// Four monomorphized variants, for callers who already know which algorithm they want (** @type: true *) val compute_sha1: compute_st SHA1 (** @type: true *) val compute_sha2_256: compute_st SHA2_256 (** @type: true *) val compute_sha2_384: compute_st SHA2_384 (** @type: true *) val compute_sha2_512: compute_st SHA2_512 (** @type: true *) val compute_blake2s: compute_st Blake2S (** @type: true *) val compute_blake2b: compute_st Blake2B let compute_sha1 = let open Hacl.Hash.SHA1 in mk_compute (|SHA1, ()|) hash_oneshot alloca init update_multi update_last finish (* This implementation calls into EverCrypt.Hash, which multiplexes between Hacl and Vale implementations of SHA2_256 functions depending on the static configuration and CPUID *) let compute_sha2_256 = let open Hacl.Hash.SHA2 in mk_compute (|SHA2_256, ()|) hash_256 alloca_256 init_256 EverCrypt.Hash.update_multi_256 update_last_256 finish_256 let compute_sha2_384 = let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (|SHA2_384, ()|) hash_384 alloca_384 init_384 update_multi_384 update_last_384 finish_384
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Streaming.SHA2.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "Hacl.HMAC.fsti.checked", "Hacl.Hash.SHA2.fsti.checked", "Hacl.Hash.SHA1.fsti.checked", "Hacl.Hash.Blake2s_32.fsti.checked", "Hacl.Hash.Blake2b_32.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.Incremental.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.HMAC.fst" }
[ { "abbrev": true, "full_module": "EverCrypt.Hash.Incremental", "short_module": "Useless" }, { "abbrev": false, "full_module": "Hacl.HMAC", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.HMAC", "short_module": null }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": 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.HMAC.compute_st Spec.Hash.Definitions.SHA2_512
Prims.Tot
[ "total" ]
[]
[ "Hacl.HMAC.mk_compute", "Prims.Mkdtuple2", "Spec.Hash.Definitions.hash_alg", "Hacl.Hash.Definitions.m_spec", "Spec.Hash.Definitions.SHA2_512", "Hacl.Streaming.SHA2.hash_512", "Hacl.Hash.SHA2.alloca_512", "Hacl.Hash.SHA2.init_512", "Hacl.Hash.SHA2.update_multi_512", "Hacl.Hash.SHA2.update_last_512", "Hacl.Hash.SHA2.finish_512" ]
[]
false
false
false
true
false
let compute_sha2_512 =
let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (| SHA2_512, () |) hash_512 alloca_512 init_512 update_multi_512 update_last_512 finish_512
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.digest
val digest : Hacl.Streaming.Functor.digest_st Hacl.Streaming.MD5.hacl_md5 () (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
let digest = F.digest hacl_md5 () (state_t_md5.s ()) (G.erased unit)
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 68, "end_line": 42, "start_col": 0, "start_line": 42 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5 inline_for_extraction noextract let state_t_md5 = state_t MD5 /// Type abbreviation - for pretty code generation let state_t = Hacl.Streaming.MD.state_32 noextract let alloca = F.alloca hacl_md5 () (state_t_md5.s ()) (G.erased unit) let malloc = F.malloc hacl_md5 () (state_t_md5.s ()) (G.erased unit) let reset = F.reset hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit) [@@ Comment "0 = success, 1 = max length exceeded" ]
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Streaming.Functor.digest_st Hacl.Streaming.MD5.hacl_md5 () (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.Functor.digest", "Prims.unit", "Hacl.Streaming.MD5.hacl_md5", "Hacl.Streaming.Interface.__proj__Stateful__item__s", "Hacl.Streaming.MD5.state_t_md5", "FStar.Ghost.erased" ]
[]
false
false
false
false
false
let digest =
F.digest hacl_md5 () (state_t_md5.s ()) (G.erased unit)
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.update
val update : Hacl.Streaming.Functor.update_st Hacl.Streaming.MD5.hacl_md5 (FStar.Ghost.reveal (FStar.Ghost.hide ())) (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
let update = F.update hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit)
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 77, "end_line": 41, "start_col": 0, "start_line": 41 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5 inline_for_extraction noextract let state_t_md5 = state_t MD5 /// Type abbreviation - for pretty code generation let state_t = Hacl.Streaming.MD.state_32 noextract let alloca = F.alloca hacl_md5 () (state_t_md5.s ()) (G.erased unit) let malloc = F.malloc hacl_md5 () (state_t_md5.s ()) (G.erased unit) let reset = F.reset hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Streaming.Functor.update_st Hacl.Streaming.MD5.hacl_md5 (FStar.Ghost.reveal (FStar.Ghost.hide ())) (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.Functor.update", "Prims.unit", "Hacl.Streaming.MD5.hacl_md5", "FStar.Ghost.hide", "Hacl.Streaming.Interface.__proj__Stateful__item__s", "Hacl.Streaming.MD5.state_t_md5", "FStar.Ghost.erased" ]
[]
false
false
false
false
false
let update =
F.update hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit)
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.free
val free : Hacl.Streaming.Functor.free_st Hacl.Streaming.MD5.hacl_md5 (FStar.Ghost.reveal (FStar.Ghost.hide ())) (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
let free = F.free hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit)
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 73, "end_line": 43, "start_col": 0, "start_line": 43 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5 inline_for_extraction noextract let state_t_md5 = state_t MD5 /// Type abbreviation - for pretty code generation let state_t = Hacl.Streaming.MD.state_32 noextract let alloca = F.alloca hacl_md5 () (state_t_md5.s ()) (G.erased unit) let malloc = F.malloc hacl_md5 () (state_t_md5.s ()) (G.erased unit) let reset = F.reset hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit) [@@ Comment "0 = success, 1 = max length exceeded" ] let update = F.update hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Streaming.Functor.free_st Hacl.Streaming.MD5.hacl_md5 (FStar.Ghost.reveal (FStar.Ghost.hide ())) (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.Functor.free", "Prims.unit", "Hacl.Streaming.MD5.hacl_md5", "FStar.Ghost.hide", "Hacl.Streaming.Interface.__proj__Stateful__item__s", "Hacl.Streaming.MD5.state_t_md5", "FStar.Ghost.erased" ]
[]
false
false
false
false
false
let free =
F.free hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit)
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.state_t_md5
val state_t_md5 : Hacl.Streaming.Interface.stateful Prims.unit
let state_t_md5 = state_t MD5
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 30, "start_col": 0, "start_line": 30 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Streaming.Interface.stateful Prims.unit
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.MD.state_t", "Spec.Hash.Definitions.MD5" ]
[]
false
false
false
true
false
let state_t_md5 =
state_t MD5
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.reset
val reset : Hacl.Streaming.Functor.reset_st Hacl.Streaming.MD5.hacl_md5 (FStar.Ghost.hide (FStar.Ghost.reveal (FStar.Ghost.hide ()))) (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
let reset = F.reset hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit)
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 75, "end_line": 38, "start_col": 0, "start_line": 38 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5 inline_for_extraction noextract let state_t_md5 = state_t MD5 /// Type abbreviation - for pretty code generation let state_t = Hacl.Streaming.MD.state_32 noextract let alloca = F.alloca hacl_md5 () (state_t_md5.s ()) (G.erased unit)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Streaming.Functor.reset_st Hacl.Streaming.MD5.hacl_md5 (FStar.Ghost.hide (FStar.Ghost.reveal (FStar.Ghost.hide ()))) (Stateful?.s Hacl.Streaming.MD5.state_t_md5 ()) (FStar.Ghost.erased Prims.unit)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Streaming.Functor.reset", "Prims.unit", "Hacl.Streaming.MD5.hacl_md5", "FStar.Ghost.hide", "Hacl.Streaming.Interface.__proj__Stateful__item__s", "Hacl.Streaming.MD5.state_t_md5", "FStar.Ghost.erased" ]
[]
false
false
false
false
false
let reset =
F.reset hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit)
false
EverCrypt.HMAC.fst
EverCrypt.HMAC.compute_sha2_256
val compute_sha2_256: compute_st SHA2_256
val compute_sha2_256: compute_st SHA2_256
let compute_sha2_256 = let open Hacl.Hash.SHA2 in mk_compute (|SHA2_256, ()|) hash_256 alloca_256 init_256 EverCrypt.Hash.update_multi_256 update_last_256 finish_256
{ "file_name": "providers/evercrypt/fst/EverCrypt.HMAC.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 39, "end_line": 66, "start_col": 0, "start_line": 62 }
(* Agile HMAC *) module EverCrypt.HMAC open Hacl.HMAC // EverCrypt.Hash.Incremental.hash_256 is marked as private, so it is // inaccessible from here. Furthermore, the EverCrypt.Hash.Incremental module // does not have an interface, meaning that we can't even friend it! Writing an // interface for EverCrypt.Hash.Incremental is possible, but doesn't make much // sense: instantiations of the functor offer, by construction, an abstract // interface. Fortunately, we can use tactics to stealthily gain access to a // private definition that F* normally won't let us access. let super_hack () = let open FStar.Tactics in let hash_256 = [ "EverCrypt"; "Hash"; "Incremental"; "hash_256"] in let hash_256 = FStar.Tactics.pack_fv hash_256 in let hash_256 = pack (Tv_FVar hash_256) in let fv = pack_fv (cur_module () `FStar.List.Tot.append` [ "hash_256" ]) in let t: term = pack Tv_Unknown in let se = pack_sigelt (Sg_Let false [ pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = t; lb_def = hash_256 }) ]) in [ se ] %splice[hash_256] (super_hack ()) // Due to the hack above, the dependency arrow is invisible to the F* // parser/lexer, so we add an explicit dependency edge to avoid build errors. module Useless = EverCrypt.Hash.Incremental /// Four monomorphized variants, for callers who already know which algorithm they want (** @type: true *) val compute_sha1: compute_st SHA1 (** @type: true *) val compute_sha2_256: compute_st SHA2_256 (** @type: true *) val compute_sha2_384: compute_st SHA2_384 (** @type: true *) val compute_sha2_512: compute_st SHA2_512 (** @type: true *) val compute_blake2s: compute_st Blake2S (** @type: true *) val compute_blake2b: compute_st Blake2B let compute_sha1 = let open Hacl.Hash.SHA1 in mk_compute (|SHA1, ()|) hash_oneshot alloca init update_multi update_last finish (* This implementation calls into EverCrypt.Hash, which multiplexes between Hacl and Vale implementations of SHA2_256 functions depending on
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Streaming.SHA2.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "Hacl.HMAC.fsti.checked", "Hacl.Hash.SHA2.fsti.checked", "Hacl.Hash.SHA1.fsti.checked", "Hacl.Hash.Blake2s_32.fsti.checked", "Hacl.Hash.Blake2b_32.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.Incremental.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.HMAC.fst" }
[ { "abbrev": true, "full_module": "EverCrypt.Hash.Incremental", "short_module": "Useless" }, { "abbrev": false, "full_module": "Hacl.HMAC", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.HMAC", "short_module": null }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": 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.HMAC.compute_st Spec.Hash.Definitions.SHA2_256
Prims.Tot
[ "total" ]
[]
[ "Hacl.HMAC.mk_compute", "Prims.Mkdtuple2", "Spec.Hash.Definitions.hash_alg", "Hacl.Hash.Definitions.m_spec", "Spec.Hash.Definitions.SHA2_256", "EverCrypt.HMAC.hash_256", "Hacl.Hash.SHA2.alloca_256", "Hacl.Hash.SHA2.init_256", "EverCrypt.Hash.update_multi_256", "Hacl.Hash.SHA2.update_last_256", "Hacl.Hash.SHA2.finish_256" ]
[]
false
false
false
true
false
let compute_sha2_256 =
let open Hacl.Hash.SHA2 in mk_compute (| SHA2_256, () |) hash_256 alloca_256 init_256 EverCrypt.Hash.update_multi_256 update_last_256 finish_256
false
EverCrypt.HMAC.fst
EverCrypt.HMAC.compute_blake2s
val compute_blake2s: compute_st Blake2S
val compute_blake2s: compute_st Blake2S
let compute_blake2s = let open Hacl.Hash.Blake2s_32 in mk_compute (|Blake2S, Hacl.Impl.Blake2.Core.M32|) hash alloca init update_multi update_last finish
{ "file_name": "providers/evercrypt/fst/EverCrypt.HMAC.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 83, "start_col": 0, "start_line": 80 }
(* Agile HMAC *) module EverCrypt.HMAC open Hacl.HMAC // EverCrypt.Hash.Incremental.hash_256 is marked as private, so it is // inaccessible from here. Furthermore, the EverCrypt.Hash.Incremental module // does not have an interface, meaning that we can't even friend it! Writing an // interface for EverCrypt.Hash.Incremental is possible, but doesn't make much // sense: instantiations of the functor offer, by construction, an abstract // interface. Fortunately, we can use tactics to stealthily gain access to a // private definition that F* normally won't let us access. let super_hack () = let open FStar.Tactics in let hash_256 = [ "EverCrypt"; "Hash"; "Incremental"; "hash_256"] in let hash_256 = FStar.Tactics.pack_fv hash_256 in let hash_256 = pack (Tv_FVar hash_256) in let fv = pack_fv (cur_module () `FStar.List.Tot.append` [ "hash_256" ]) in let t: term = pack Tv_Unknown in let se = pack_sigelt (Sg_Let false [ pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = t; lb_def = hash_256 }) ]) in [ se ] %splice[hash_256] (super_hack ()) // Due to the hack above, the dependency arrow is invisible to the F* // parser/lexer, so we add an explicit dependency edge to avoid build errors. module Useless = EverCrypt.Hash.Incremental /// Four monomorphized variants, for callers who already know which algorithm they want (** @type: true *) val compute_sha1: compute_st SHA1 (** @type: true *) val compute_sha2_256: compute_st SHA2_256 (** @type: true *) val compute_sha2_384: compute_st SHA2_384 (** @type: true *) val compute_sha2_512: compute_st SHA2_512 (** @type: true *) val compute_blake2s: compute_st Blake2S (** @type: true *) val compute_blake2b: compute_st Blake2B let compute_sha1 = let open Hacl.Hash.SHA1 in mk_compute (|SHA1, ()|) hash_oneshot alloca init update_multi update_last finish (* This implementation calls into EverCrypt.Hash, which multiplexes between Hacl and Vale implementations of SHA2_256 functions depending on the static configuration and CPUID *) let compute_sha2_256 = let open Hacl.Hash.SHA2 in mk_compute (|SHA2_256, ()|) hash_256 alloca_256 init_256 EverCrypt.Hash.update_multi_256 update_last_256 finish_256 let compute_sha2_384 = let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (|SHA2_384, ()|) hash_384 alloca_384 init_384 update_multi_384 update_last_384 finish_384 let compute_sha2_512 = let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (|SHA2_512, ()|) hash_512 alloca_512 init_512 update_multi_512 update_last_512 finish_512
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Streaming.SHA2.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "Hacl.HMAC.fsti.checked", "Hacl.Hash.SHA2.fsti.checked", "Hacl.Hash.SHA1.fsti.checked", "Hacl.Hash.Blake2s_32.fsti.checked", "Hacl.Hash.Blake2b_32.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.Incremental.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.HMAC.fst" }
[ { "abbrev": true, "full_module": "EverCrypt.Hash.Incremental", "short_module": "Useless" }, { "abbrev": false, "full_module": "Hacl.HMAC", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.HMAC", "short_module": null }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": 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.HMAC.compute_st Spec.Hash.Definitions.Blake2S
Prims.Tot
[ "total" ]
[]
[ "Hacl.HMAC.mk_compute", "Prims.Mkdtuple2", "Spec.Hash.Definitions.hash_alg", "Hacl.Hash.Definitions.m_spec", "Spec.Hash.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M32", "Hacl.Hash.Blake2s_32.hash", "Hacl.Hash.Blake2s_32.alloca", "Hacl.Hash.Blake2s_32.init", "Hacl.Hash.Blake2s_32.update_multi", "Hacl.Hash.Blake2s_32.update_last", "Hacl.Hash.Blake2s_32.finish" ]
[]
false
false
false
true
false
let compute_blake2s =
let open Hacl.Hash.Blake2s_32 in mk_compute (| Blake2S, Hacl.Impl.Blake2.Core.M32 |) hash alloca init update_multi update_last finish
false
FStar.MSTTotal.fst
FStar.MSTTotal.subcomp
val subcomp (a: Type) (state: Type u#2) (rel: P.preorder state) (req_f: pre_t state) (ens_f: post_t state a) (req_g: pre_t state) (ens_g: post_t state a) (f: repr a state rel req_f ens_f) : Pure (repr a state rel req_g ens_g) (requires (forall s. req_g s ==> req_f s) /\ (forall s0 x s1. (req_g s0 /\ ens_f s0 x s1) ==> ens_g s0 x s1)) (ensures fun _ -> True)
val subcomp (a: Type) (state: Type u#2) (rel: P.preorder state) (req_f: pre_t state) (ens_f: post_t state a) (req_g: pre_t state) (ens_g: post_t state a) (f: repr a state rel req_f ens_f) : Pure (repr a state rel req_g ens_g) (requires (forall s. req_g s ==> req_f s) /\ (forall s0 x s1. (req_g s0 /\ ens_f s0 x s1) ==> ens_g s0 x s1)) (ensures fun _ -> True)
let subcomp (a:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:pre_t state) (ens_g:post_t state a) (f:repr a state rel req_f ens_f) : Pure (repr a state rel req_g ens_g) (requires (forall s. req_g s ==> req_f s) /\ (forall s0 x s1. (req_g s0 /\ ens_f s0 x s1) ==> ens_g s0 x s1)) (ensures fun _ -> True) = f
{ "file_name": "ulib/experimental/FStar.MSTTotal.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 84, "start_col": 0, "start_line": 69 }
(* 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 FStar.MSTTotal module W = FStar.Witnessed.Core module P = FStar.Preorder open FStar.Monotonic.Pure type pre_t (state:Type u#2) = state -> Type0 type post_t (state:Type u#2) (a:Type u#a) = state -> a -> state -> Type0 type repr (a:Type) (state:Type u#2) (rel:P.preorder state) (req:pre_t state) (ens:post_t state a) = s0:state -> PURE (a & state) (as_pure_wp (fun p -> req s0 /\ (forall (x:a) (s1:state). (ens s0 x s1 /\ rel s0 s1) ==> p (x, s1)))) let return (a:Type) (x:a) (state:Type u#2) (rel:P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1) = fun s0 -> x, s0 let bind (a:Type) (b:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:a -> pre_t state) (ens_g:a -> post_t state b) (f:repr a state rel req_f ens_f) (g:(x:a -> repr b state rel (req_g x) (ens_g x))) : repr b state rel (fun s0 -> req_f s0 /\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1)) (fun s0 r s2 -> req_f s0 /\ (exists x s1. ens_f s0 x s1 /\ (req_g x) s1 /\ (ens_g x) s1 r s2)) = fun s0 -> let x, s1 = f s0 in (g x) s1
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Witnessed.Core.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "FStar.MSTTotal.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": true, "full_module": "FStar.Witnessed.Core", "short_module": "W" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> state: Type -> rel: FStar.Preorder.preorder state -> req_f: FStar.MSTTotal.pre_t state -> ens_f: FStar.MSTTotal.post_t state a -> req_g: FStar.MSTTotal.pre_t state -> ens_g: FStar.MSTTotal.post_t state a -> f: FStar.MSTTotal.repr a state rel req_f ens_f -> Prims.Pure (FStar.MSTTotal.repr a state rel req_g ens_g)
Prims.Pure
[]
[]
[ "FStar.Preorder.preorder", "FStar.MSTTotal.pre_t", "FStar.MSTTotal.post_t", "FStar.MSTTotal.repr", "Prims.l_and", "Prims.l_Forall", "Prims.l_imp", "Prims.l_True" ]
[]
false
false
false
false
false
let subcomp (a: Type) (state: Type u#2) (rel: P.preorder state) (req_f: pre_t state) (ens_f: post_t state a) (req_g: pre_t state) (ens_g: post_t state a) (f: repr a state rel req_f ens_f) : Pure (repr a state rel req_g ens_g) (requires (forall s. req_g s ==> req_f s) /\ (forall s0 x s1. (req_g s0 /\ ens_f s0 x s1) ==> ens_g s0 x s1)) (ensures fun _ -> True) =
f
false
FStar.MSTTotal.fst
FStar.MSTTotal.return
val return (a: Type) (x: a) (state: Type u#2) (rel: P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1)
val return (a: Type) (x: a) (state: Type u#2) (rel: P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1)
let return (a:Type) (x:a) (state:Type u#2) (rel:P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1) = fun s0 -> x, s0
{ "file_name": "ulib/experimental/FStar.MSTTotal.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 17, "end_line": 48, "start_col": 0, "start_line": 39 }
(* 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 FStar.MSTTotal module W = FStar.Witnessed.Core module P = FStar.Preorder open FStar.Monotonic.Pure type pre_t (state:Type u#2) = state -> Type0 type post_t (state:Type u#2) (a:Type u#a) = state -> a -> state -> Type0 type repr (a:Type) (state:Type u#2) (rel:P.preorder state) (req:pre_t state) (ens:post_t state a) = s0:state -> PURE (a & state) (as_pure_wp (fun p -> req s0 /\ (forall (x:a) (s1:state). (ens s0 x s1 /\ rel s0 s1) ==> p (x, s1))))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Witnessed.Core.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "FStar.MSTTotal.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": true, "full_module": "FStar.Witnessed.Core", "short_module": "W" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> x: a -> state: Type -> rel: FStar.Preorder.preorder state -> FStar.MSTTotal.repr a state rel (fun _ -> Prims.l_True) (fun s0 r s1 -> r == x /\ s0 == s1)
Prims.Tot
[ "total" ]
[]
[ "FStar.Preorder.preorder", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.tuple2", "FStar.MSTTotal.repr", "Prims.l_True", "Prims.l_and", "Prims.eq2" ]
[]
false
false
false
false
false
let return (a: Type) (x: a) (state: Type u#2) (rel: P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1) =
fun s0 -> x, s0
false
FStar.MSTTotal.fst
FStar.MSTTotal.put
val put (#state: Type u#2) (#rel: P.preorder state) (s: state) : MSTATETOT unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s)
val put (#state: Type u#2) (#rel: P.preorder state) (s: state) : MSTATETOT unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s)
let put (#state:Type u#2) (#rel:P.preorder state) (s:state) : MSTATETOT unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s) = MSTATETOT?.reflect (fun _ -> (), s)
{ "file_name": "ulib/experimental/FStar.MSTTotal.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 37, "end_line": 129, "start_col": 0, "start_line": 124 }
(* 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 FStar.MSTTotal module W = FStar.Witnessed.Core module P = FStar.Preorder open FStar.Monotonic.Pure type pre_t (state:Type u#2) = state -> Type0 type post_t (state:Type u#2) (a:Type u#a) = state -> a -> state -> Type0 type repr (a:Type) (state:Type u#2) (rel:P.preorder state) (req:pre_t state) (ens:post_t state a) = s0:state -> PURE (a & state) (as_pure_wp (fun p -> req s0 /\ (forall (x:a) (s1:state). (ens s0 x s1 /\ rel s0 s1) ==> p (x, s1)))) let return (a:Type) (x:a) (state:Type u#2) (rel:P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1) = fun s0 -> x, s0 let bind (a:Type) (b:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:a -> pre_t state) (ens_g:a -> post_t state b) (f:repr a state rel req_f ens_f) (g:(x:a -> repr b state rel (req_g x) (ens_g x))) : repr b state rel (fun s0 -> req_f s0 /\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1)) (fun s0 r s2 -> req_f s0 /\ (exists x s1. ens_f s0 x s1 /\ (req_g x) s1 /\ (ens_g x) s1 r s2)) = fun s0 -> let x, s1 = f s0 in (g x) s1 let subcomp (a:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:pre_t state) (ens_g:post_t state a) (f:repr a state rel req_f ens_f) : Pure (repr a state rel req_g ens_g) (requires (forall s. req_g s ==> req_f s) /\ (forall s0 x s1. (req_g s0 /\ ens_f s0 x s1) ==> ens_g s0 x s1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (state:Type u#2) (rel:P.preorder state) (req_then:pre_t state) (ens_then:post_t state a) (req_else:pre_t state) (ens_else:post_t state a) (f:repr a state rel req_then ens_then) (g:repr a state rel req_else ens_else) (p:bool) : Type = repr a state rel (fun s -> (b2t p ==> req_then s) /\ ((~ (b2t p)) ==> req_else s)) (fun s0 x s1 -> (b2t p ==> ens_then s0 x s1) /\ ((~ (b2t p)) ==> ens_else s0 x s1)) [@@ primitive_extraction] total reflectable effect { MSTATETOT (a:Type) ([@@@ effect_param] state:Type u#2) ([@@@ effect_param] rel:P.preorder state) (req:pre_t state) (ens:post_t state a) with { repr; return; bind; subcomp; if_then_else } } [@@ noextract_to "krml"] let get (#state:Type u#2) (#rel:P.preorder state) () : MSTATETOT state state rel (fun _ -> True) (fun s0 r s1 -> s0 == r /\ r == s1) = MSTATETOT?.reflect (fun s0 -> s0, s0)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Witnessed.Core.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "FStar.MSTTotal.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": true, "full_module": "FStar.Witnessed.Core", "short_module": "W" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: state -> FStar.MSTTotal.MSTATETOT Prims.unit
FStar.MSTTotal.MSTATETOT
[]
[]
[ "FStar.Preorder.preorder", "FStar.Pervasives.Native.Mktuple2", "Prims.unit", "FStar.Pervasives.Native.tuple2", "Prims.eq2" ]
[]
false
true
false
false
false
let put (#state: Type u#2) (#rel: P.preorder state) (s: state) : MSTATETOT unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s) =
MSTATETOT?.reflect (fun _ -> (), s)
false
FStar.MSTTotal.fst
FStar.MSTTotal.bind
val bind (a b: Type) (state: Type u#2) (rel: P.preorder state) (req_f: pre_t state) (ens_f: post_t state a) (req_g: (a -> pre_t state)) (ens_g: (a -> post_t state b)) (f: repr a state rel req_f ens_f) (g: (x: a -> repr b state rel (req_g x) (ens_g x))) : repr b state rel (fun s0 -> req_f s0 /\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1)) (fun s0 r s2 -> req_f s0 /\ (exists x s1. ens_f s0 x s1 /\ (req_g x) s1 /\ (ens_g x) s1 r s2))
val bind (a b: Type) (state: Type u#2) (rel: P.preorder state) (req_f: pre_t state) (ens_f: post_t state a) (req_g: (a -> pre_t state)) (ens_g: (a -> post_t state b)) (f: repr a state rel req_f ens_f) (g: (x: a -> repr b state rel (req_g x) (ens_g x))) : repr b state rel (fun s0 -> req_f s0 /\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1)) (fun s0 r s2 -> req_f s0 /\ (exists x s1. ens_f s0 x s1 /\ (req_g x) s1 /\ (ens_g x) s1 r s2))
let bind (a:Type) (b:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:a -> pre_t state) (ens_g:a -> post_t state b) (f:repr a state rel req_f ens_f) (g:(x:a -> repr b state rel (req_g x) (ens_g x))) : repr b state rel (fun s0 -> req_f s0 /\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1)) (fun s0 r s2 -> req_f s0 /\ (exists x s1. ens_f s0 x s1 /\ (req_g x) s1 /\ (ens_g x) s1 r s2)) = fun s0 -> let x, s1 = f s0 in (g x) s1
{ "file_name": "ulib/experimental/FStar.MSTTotal.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 12, "end_line": 67, "start_col": 0, "start_line": 50 }
(* 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 FStar.MSTTotal module W = FStar.Witnessed.Core module P = FStar.Preorder open FStar.Monotonic.Pure type pre_t (state:Type u#2) = state -> Type0 type post_t (state:Type u#2) (a:Type u#a) = state -> a -> state -> Type0 type repr (a:Type) (state:Type u#2) (rel:P.preorder state) (req:pre_t state) (ens:post_t state a) = s0:state -> PURE (a & state) (as_pure_wp (fun p -> req s0 /\ (forall (x:a) (s1:state). (ens s0 x s1 /\ rel s0 s1) ==> p (x, s1)))) let return (a:Type) (x:a) (state:Type u#2) (rel:P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1) = fun s0 -> x, s0
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Witnessed.Core.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "FStar.MSTTotal.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": true, "full_module": "FStar.Witnessed.Core", "short_module": "W" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> b: Type -> state: Type -> rel: FStar.Preorder.preorder state -> req_f: FStar.MSTTotal.pre_t state -> ens_f: FStar.MSTTotal.post_t state a -> req_g: (_: a -> FStar.MSTTotal.pre_t state) -> ens_g: (_: a -> FStar.MSTTotal.post_t state b) -> f: FStar.MSTTotal.repr a state rel req_f ens_f -> g: (x: a -> FStar.MSTTotal.repr b state rel (req_g x) (ens_g x)) -> FStar.MSTTotal.repr b state rel (fun s0 -> req_f s0 /\ (forall (x: a) (s1: state). ens_f s0 x s1 ==> req_g x s1)) (fun s0 r s2 -> req_f s0 /\ (exists (x: a) (s1: state). ens_f s0 x s1 /\ req_g x s1 /\ ens_g x s1 r s2))
Prims.Tot
[ "total" ]
[]
[ "FStar.Preorder.preorder", "FStar.MSTTotal.pre_t", "FStar.MSTTotal.post_t", "FStar.MSTTotal.repr", "FStar.Pervasives.Native.tuple2", "Prims.l_and", "Prims.l_Forall", "Prims.l_imp", "Prims.l_Exists" ]
[]
false
false
false
false
false
let bind (a b: Type) (state: Type u#2) (rel: P.preorder state) (req_f: pre_t state) (ens_f: post_t state a) (req_g: (a -> pre_t state)) (ens_g: (a -> post_t state b)) (f: repr a state rel req_f ens_f) (g: (x: a -> repr b state rel (req_g x) (ens_g x))) : repr b state rel (fun s0 -> req_f s0 /\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1)) (fun s0 r s2 -> req_f s0 /\ (exists x s1. ens_f s0 x s1 /\ (req_g x) s1 /\ (ens_g x) s1 r s2)) =
fun s0 -> let x, s1 = f s0 in (g x) s1
false
FStar.MSTTotal.fst
FStar.MSTTotal.get
val get: #state: Type u#2 -> #rel: P.preorder state -> Prims.unit -> MSTATETOT state state rel (fun _ -> True) (fun s0 r s1 -> s0 == r /\ r == s1)
val get: #state: Type u#2 -> #rel: P.preorder state -> Prims.unit -> MSTATETOT state state rel (fun _ -> True) (fun s0 r s1 -> s0 == r /\ r == s1)
let get (#state:Type u#2) (#rel:P.preorder state) () : MSTATETOT state state rel (fun _ -> True) (fun s0 r s1 -> s0 == r /\ r == s1) = MSTATETOT?.reflect (fun s0 -> s0, s0)
{ "file_name": "ulib/experimental/FStar.MSTTotal.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": 116 }
(* 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 FStar.MSTTotal module W = FStar.Witnessed.Core module P = FStar.Preorder open FStar.Monotonic.Pure type pre_t (state:Type u#2) = state -> Type0 type post_t (state:Type u#2) (a:Type u#a) = state -> a -> state -> Type0 type repr (a:Type) (state:Type u#2) (rel:P.preorder state) (req:pre_t state) (ens:post_t state a) = s0:state -> PURE (a & state) (as_pure_wp (fun p -> req s0 /\ (forall (x:a) (s1:state). (ens s0 x s1 /\ rel s0 s1) ==> p (x, s1)))) let return (a:Type) (x:a) (state:Type u#2) (rel:P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1) = fun s0 -> x, s0 let bind (a:Type) (b:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:a -> pre_t state) (ens_g:a -> post_t state b) (f:repr a state rel req_f ens_f) (g:(x:a -> repr b state rel (req_g x) (ens_g x))) : repr b state rel (fun s0 -> req_f s0 /\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1)) (fun s0 r s2 -> req_f s0 /\ (exists x s1. ens_f s0 x s1 /\ (req_g x) s1 /\ (ens_g x) s1 r s2)) = fun s0 -> let x, s1 = f s0 in (g x) s1 let subcomp (a:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:pre_t state) (ens_g:post_t state a) (f:repr a state rel req_f ens_f) : Pure (repr a state rel req_g ens_g) (requires (forall s. req_g s ==> req_f s) /\ (forall s0 x s1. (req_g s0 /\ ens_f s0 x s1) ==> ens_g s0 x s1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (state:Type u#2) (rel:P.preorder state) (req_then:pre_t state) (ens_then:post_t state a) (req_else:pre_t state) (ens_else:post_t state a) (f:repr a state rel req_then ens_then) (g:repr a state rel req_else ens_else) (p:bool) : Type = repr a state rel (fun s -> (b2t p ==> req_then s) /\ ((~ (b2t p)) ==> req_else s)) (fun s0 x s1 -> (b2t p ==> ens_then s0 x s1) /\ ((~ (b2t p)) ==> ens_else s0 x s1)) [@@ primitive_extraction] total reflectable effect { MSTATETOT (a:Type) ([@@@ effect_param] state:Type u#2) ([@@@ effect_param] rel:P.preorder state) (req:pre_t state) (ens:post_t state a) with { repr; return; bind; subcomp; if_then_else } }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Witnessed.Core.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "FStar.MSTTotal.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": true, "full_module": "FStar.Witnessed.Core", "short_module": "W" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.MSTTotal.MSTATETOT state
FStar.MSTTotal.MSTATETOT
[]
[]
[ "FStar.Preorder.preorder", "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.tuple2", "Prims.l_True", "Prims.l_and", "Prims.eq2" ]
[]
false
true
false
false
false
let get (#state: Type u#2) (#rel: P.preorder state) () : MSTATETOT state state rel (fun _ -> True) (fun s0 r s1 -> s0 == r /\ r == s1) =
MSTATETOT?.reflect (fun s0 -> s0, s0)
false
FStar.MSTTotal.fst
FStar.MSTTotal.lift_pure_mst_total
val lift_pure_mst_total (a: Type) (wp: pure_wp a) (state: Type u#2) (rel: P.preorder state) (f: (eqtype_as_type unit -> PURE a wp)) : repr a state rel (fun s0 -> wp (fun _ -> True)) (fun s0 x s1 -> wp (fun _ -> True) /\ (~(wp (fun r -> r =!= x \/ s0 =!= s1))))
val lift_pure_mst_total (a: Type) (wp: pure_wp a) (state: Type u#2) (rel: P.preorder state) (f: (eqtype_as_type unit -> PURE a wp)) : repr a state rel (fun s0 -> wp (fun _ -> True)) (fun s0 x s1 -> wp (fun _ -> True) /\ (~(wp (fun r -> r =!= x \/ s0 =!= s1))))
let lift_pure_mst_total (a:Type) (wp:pure_wp a) (state:Type u#2) (rel:P.preorder state) (f:eqtype_as_type unit -> PURE a wp) : repr a state rel (fun s0 -> wp (fun _ -> True)) (fun s0 x s1 -> wp (fun _ -> True) /\ (~ (wp (fun r -> r =!= x \/ s0 =!= s1)))) = elim_pure_wp_monotonicity wp; fun s0 -> let x = f () in x, s0
{ "file_name": "ulib/experimental/FStar.MSTTotal.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 9, "end_line": 190, "start_col": 0, "start_line": 177 }
(* 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 FStar.MSTTotal module W = FStar.Witnessed.Core module P = FStar.Preorder open FStar.Monotonic.Pure type pre_t (state:Type u#2) = state -> Type0 type post_t (state:Type u#2) (a:Type u#a) = state -> a -> state -> Type0 type repr (a:Type) (state:Type u#2) (rel:P.preorder state) (req:pre_t state) (ens:post_t state a) = s0:state -> PURE (a & state) (as_pure_wp (fun p -> req s0 /\ (forall (x:a) (s1:state). (ens s0 x s1 /\ rel s0 s1) ==> p (x, s1)))) let return (a:Type) (x:a) (state:Type u#2) (rel:P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1) = fun s0 -> x, s0 let bind (a:Type) (b:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:a -> pre_t state) (ens_g:a -> post_t state b) (f:repr a state rel req_f ens_f) (g:(x:a -> repr b state rel (req_g x) (ens_g x))) : repr b state rel (fun s0 -> req_f s0 /\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1)) (fun s0 r s2 -> req_f s0 /\ (exists x s1. ens_f s0 x s1 /\ (req_g x) s1 /\ (ens_g x) s1 r s2)) = fun s0 -> let x, s1 = f s0 in (g x) s1 let subcomp (a:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:pre_t state) (ens_g:post_t state a) (f:repr a state rel req_f ens_f) : Pure (repr a state rel req_g ens_g) (requires (forall s. req_g s ==> req_f s) /\ (forall s0 x s1. (req_g s0 /\ ens_f s0 x s1) ==> ens_g s0 x s1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (state:Type u#2) (rel:P.preorder state) (req_then:pre_t state) (ens_then:post_t state a) (req_else:pre_t state) (ens_else:post_t state a) (f:repr a state rel req_then ens_then) (g:repr a state rel req_else ens_else) (p:bool) : Type = repr a state rel (fun s -> (b2t p ==> req_then s) /\ ((~ (b2t p)) ==> req_else s)) (fun s0 x s1 -> (b2t p ==> ens_then s0 x s1) /\ ((~ (b2t p)) ==> ens_else s0 x s1)) [@@ primitive_extraction] total reflectable effect { MSTATETOT (a:Type) ([@@@ effect_param] state:Type u#2) ([@@@ effect_param] rel:P.preorder state) (req:pre_t state) (ens:post_t state a) with { repr; return; bind; subcomp; if_then_else } } [@@ noextract_to "krml"] let get (#state:Type u#2) (#rel:P.preorder state) () : MSTATETOT state state rel (fun _ -> True) (fun s0 r s1 -> s0 == r /\ r == s1) = MSTATETOT?.reflect (fun s0 -> s0, s0) [@@ noextract_to "krml"] let put (#state:Type u#2) (#rel:P.preorder state) (s:state) : MSTATETOT unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s) = MSTATETOT?.reflect (fun _ -> (), s) assume val witness (state:Type u#2) (rel:P.preorder state) (p:W.s_predicate state) : MSTATETOT (W.witnessed state rel p) state rel (fun s0 -> p s0 /\ W.stable state rel p) (fun s0 _ s1 -> s0 == s1) assume val recall (state:Type u#2) (rel:P.preorder state) (p:W.s_predicate state) (w:W.witnessed state rel p) : MSTATETOT unit state rel (fun _ -> True) (fun s0 _ s1 -> s0 == s1 /\ p s1) (* * AR: why do we need the first conjunct in the postcondition? * * without this some proofs that use `assert e by t` fail * the way `assert e by t` works is that, it is desugared into `with_tactic e t` * that is abstract and remains in the VC as is at some point, we take a pass over * the VC, find the `with_tactic e t` nodes in it, farm out `G |= e by t` where `G` * is the context at that point in the VC in the original VC, `with_tactic e t` * is simply replace by `True`. * So why is it OK to replace it by `True`, don't we lose the fact that `e` holds for * the rest of the VC? * In the wp world of things, this works fine, since the wp of `assert e by t` is * (fun _ -> with_tactic e t /\ (e ==> ...)) * i.e. the type of `assert e by t` already introduces a cut, so replacing it by * `True` works fine. * * But this doesn't work when we use the intricate `~ (wp (fun r -> r =!= x))` * combinator to convert from wp to pre post * * Basically, the shape of the VC in that case becomes: * (with_tactic e t /\ (((~ with_tactic e t) \/ (e /\ ...)) ==> ...)) * * In this VC, if we replace the first `with_tactic e t` with `True`, for the second conjunct, * the solver can no longer reason that the first disjunct cannot hold * * The wp (fun _ -> True) below helps add that assumption to the second conjunct *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Witnessed.Core.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "FStar.MSTTotal.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": true, "full_module": "FStar.Witnessed.Core", "short_module": "W" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> wp: Prims.pure_wp a -> state: Type -> rel: FStar.Preorder.preorder state -> f: (_: FStar.Pervasives.eqtype_as_type Prims.unit -> Prims.PURE a) -> FStar.MSTTotal.repr a state rel (fun _ -> wp (fun _ -> Prims.l_True)) (fun s0 x s1 -> wp (fun _ -> Prims.l_True) /\ ~(wp (fun r -> ~(r == x) \/ ~(s0 == s1))))
Prims.Tot
[ "total" ]
[]
[ "Prims.pure_wp", "FStar.Preorder.preorder", "FStar.Pervasives.eqtype_as_type", "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.tuple2", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.MSTTotal.repr", "Prims.l_True", "Prims.l_and", "Prims.l_not", "Prims.l_or", "Prims.eq2" ]
[]
false
false
false
false
false
let lift_pure_mst_total (a: Type) (wp: pure_wp a) (state: Type u#2) (rel: P.preorder state) (f: (eqtype_as_type unit -> PURE a wp)) : repr a state rel (fun s0 -> wp (fun _ -> True)) (fun s0 x s1 -> wp (fun _ -> True) /\ (~(wp (fun r -> r =!= x \/ s0 =!= s1)))) =
elim_pure_wp_monotonicity wp; fun s0 -> let x = f () in x, s0
false
FStar.MSTTotal.fst
FStar.MSTTotal.mst_tot_assert
val mst_tot_assert (#state: Type u#2) (#rel: P.preorder state) (p: Type) : MSTATETOT unit state rel (fun _ -> p) (fun m0 _ m1 -> p /\ m0 == m1)
val mst_tot_assert (#state: Type u#2) (#rel: P.preorder state) (p: Type) : MSTATETOT unit state rel (fun _ -> p) (fun m0 _ m1 -> p /\ m0 == m1)
let mst_tot_assert (#state:Type u#2) (#rel:P.preorder state) (p:Type) : MSTATETOT unit state rel (fun _ -> p) (fun m0 _ m1 -> p /\ m0 == m1) = assert p
{ "file_name": "ulib/experimental/FStar.MSTTotal.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 10, "end_line": 208, "start_col": 0, "start_line": 205 }
(* 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 FStar.MSTTotal module W = FStar.Witnessed.Core module P = FStar.Preorder open FStar.Monotonic.Pure type pre_t (state:Type u#2) = state -> Type0 type post_t (state:Type u#2) (a:Type u#a) = state -> a -> state -> Type0 type repr (a:Type) (state:Type u#2) (rel:P.preorder state) (req:pre_t state) (ens:post_t state a) = s0:state -> PURE (a & state) (as_pure_wp (fun p -> req s0 /\ (forall (x:a) (s1:state). (ens s0 x s1 /\ rel s0 s1) ==> p (x, s1)))) let return (a:Type) (x:a) (state:Type u#2) (rel:P.preorder state) : repr a state rel (fun _ -> True) (fun s0 r s1 -> r == x /\ s0 == s1) = fun s0 -> x, s0 let bind (a:Type) (b:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:a -> pre_t state) (ens_g:a -> post_t state b) (f:repr a state rel req_f ens_f) (g:(x:a -> repr b state rel (req_g x) (ens_g x))) : repr b state rel (fun s0 -> req_f s0 /\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1)) (fun s0 r s2 -> req_f s0 /\ (exists x s1. ens_f s0 x s1 /\ (req_g x) s1 /\ (ens_g x) s1 r s2)) = fun s0 -> let x, s1 = f s0 in (g x) s1 let subcomp (a:Type) (state:Type u#2) (rel:P.preorder state) (req_f:pre_t state) (ens_f:post_t state a) (req_g:pre_t state) (ens_g:post_t state a) (f:repr a state rel req_f ens_f) : Pure (repr a state rel req_g ens_g) (requires (forall s. req_g s ==> req_f s) /\ (forall s0 x s1. (req_g s0 /\ ens_f s0 x s1) ==> ens_g s0 x s1)) (ensures fun _ -> True) = f let if_then_else (a:Type) (state:Type u#2) (rel:P.preorder state) (req_then:pre_t state) (ens_then:post_t state a) (req_else:pre_t state) (ens_else:post_t state a) (f:repr a state rel req_then ens_then) (g:repr a state rel req_else ens_else) (p:bool) : Type = repr a state rel (fun s -> (b2t p ==> req_then s) /\ ((~ (b2t p)) ==> req_else s)) (fun s0 x s1 -> (b2t p ==> ens_then s0 x s1) /\ ((~ (b2t p)) ==> ens_else s0 x s1)) [@@ primitive_extraction] total reflectable effect { MSTATETOT (a:Type) ([@@@ effect_param] state:Type u#2) ([@@@ effect_param] rel:P.preorder state) (req:pre_t state) (ens:post_t state a) with { repr; return; bind; subcomp; if_then_else } } [@@ noextract_to "krml"] let get (#state:Type u#2) (#rel:P.preorder state) () : MSTATETOT state state rel (fun _ -> True) (fun s0 r s1 -> s0 == r /\ r == s1) = MSTATETOT?.reflect (fun s0 -> s0, s0) [@@ noextract_to "krml"] let put (#state:Type u#2) (#rel:P.preorder state) (s:state) : MSTATETOT unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s) = MSTATETOT?.reflect (fun _ -> (), s) assume val witness (state:Type u#2) (rel:P.preorder state) (p:W.s_predicate state) : MSTATETOT (W.witnessed state rel p) state rel (fun s0 -> p s0 /\ W.stable state rel p) (fun s0 _ s1 -> s0 == s1) assume val recall (state:Type u#2) (rel:P.preorder state) (p:W.s_predicate state) (w:W.witnessed state rel p) : MSTATETOT unit state rel (fun _ -> True) (fun s0 _ s1 -> s0 == s1 /\ p s1) (* * AR: why do we need the first conjunct in the postcondition? * * without this some proofs that use `assert e by t` fail * the way `assert e by t` works is that, it is desugared into `with_tactic e t` * that is abstract and remains in the VC as is at some point, we take a pass over * the VC, find the `with_tactic e t` nodes in it, farm out `G |= e by t` where `G` * is the context at that point in the VC in the original VC, `with_tactic e t` * is simply replace by `True`. * So why is it OK to replace it by `True`, don't we lose the fact that `e` holds for * the rest of the VC? * In the wp world of things, this works fine, since the wp of `assert e by t` is * (fun _ -> with_tactic e t /\ (e ==> ...)) * i.e. the type of `assert e by t` already introduces a cut, so replacing it by * `True` works fine. * * But this doesn't work when we use the intricate `~ (wp (fun r -> r =!= x))` * combinator to convert from wp to pre post * * Basically, the shape of the VC in that case becomes: * (with_tactic e t /\ (((~ with_tactic e t) \/ (e /\ ...)) ==> ...)) * * In this VC, if we replace the first `with_tactic e t` with `True`, for the second conjunct, * the solver can no longer reason that the first disjunct cannot hold * * The wp (fun _ -> True) below helps add that assumption to the second conjunct *) let lift_pure_mst_total (a:Type) (wp:pure_wp a) (state:Type u#2) (rel:P.preorder state) (f:eqtype_as_type unit -> PURE a wp) : repr a state rel (fun s0 -> wp (fun _ -> True)) (fun s0 x s1 -> wp (fun _ -> True) /\ (~ (wp (fun r -> r =!= x \/ s0 =!= s1)))) = elim_pure_wp_monotonicity wp; fun s0 -> let x = f () in x, s0 sub_effect PURE ~> MSTATETOT = lift_pure_mst_total let mst_tot_assume (#state:Type u#2) (#rel:P.preorder state) (p:Type) : MSTATETOT unit state rel (fun _ -> True) (fun m0 _ m1 -> p /\ m0 == m1) = assume p let mst_tot_admit (#state:Type u#2) (#rel:P.preorder state) (#a:Type) () : MSTATETOT a state rel (fun _ -> True) (fun _ _ _ -> False) = admit ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Witnessed.Core.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "FStar.MSTTotal.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "P" }, { "abbrev": true, "full_module": "FStar.Witnessed.Core", "short_module": "W" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Type0 -> FStar.MSTTotal.MSTATETOT Prims.unit
FStar.MSTTotal.MSTATETOT
[]
[]
[ "FStar.Preorder.preorder", "Prims._assert", "Prims.unit", "Prims.l_and", "Prims.eq2" ]
[]
false
true
false
false
false
let mst_tot_assert (#state: Type u#2) (#rel: P.preorder state) (p: Type) : MSTATETOT unit state rel (fun _ -> p) (fun m0 _ m1 -> p /\ m0 == m1) =
assert p
false
Hacl.Streaming.MD5.fst
Hacl.Streaming.MD5.hash
val hash:Hacl.Hash.Definitions.hash_st MD5
val hash:Hacl.Hash.Definitions.hash_st MD5
let hash: Hacl.Hash.Definitions.hash_st MD5 = fun output input input_len -> Hacl.Hash.MD5.hash_oneshot output input input_len
{ "file_name": "code/streaming/Hacl.Streaming.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 125, "end_line": 47, "start_col": 0, "start_line": 47 }
module Hacl.Streaming.MD5 /// WARNING: this file is here for legacy purposes only. You SHOULD NOT use /// it in new code. open FStar.HyperStack.ST /// A streaming version of MD-based hashes #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" module G = FStar.Ghost module F = Hacl.Streaming.Functor open Spec.Hash.Definitions open Hacl.Streaming.Interface open Hacl.Streaming.MD /// Instantiations of the streaming functor for MD5 /// /// Some remarks: /// /// - we don't bother with using the abstraction feature since we verified /// clients like miTLS go through EverCrypt.Hash.Incremental inline_for_extraction noextract let hacl_md5 = hacl_md MD5 inline_for_extraction noextract let state_t_md5 = state_t MD5 /// Type abbreviation - for pretty code generation let state_t = Hacl.Streaming.MD.state_32 noextract let alloca = F.alloca hacl_md5 () (state_t_md5.s ()) (G.erased unit) let malloc = F.malloc hacl_md5 () (state_t_md5.s ()) (G.erased unit) let reset = F.reset hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit) [@@ Comment "0 = success, 1 = max length exceeded" ] let update = F.update hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit) let digest = F.digest hacl_md5 () (state_t_md5.s ()) (G.erased unit) let free = F.free hacl_md5 (G.hide ()) (state_t_md5.s ()) (G.erased unit) let copy = F.copy hacl_md5 () (state_t_md5.s ()) (G.erased unit)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Streaming.MD.fst.checked", "Hacl.Streaming.Interface.fsti.checked", "Hacl.Streaming.Functor.fsti.checked", "Hacl.Hash.MD5.fsti.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Streaming.MD5.fst" }
[ { "abbrev": false, "full_module": "Hacl.Streaming.MD", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming.Interface", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Streaming.Functor", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Streaming", "short_module": null }, { "abbrev": 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.Hash.Definitions.hash_st Spec.Hash.Definitions.MD5
Prims.Tot
[ "total" ]
[]
[ "Hacl.Hash.Definitions.hash_t", "Spec.Hash.Definitions.MD5", "LowStar.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Hacl.Hash.MD5.hash_oneshot", "Prims.unit" ]
[]
false
false
false
true
false
let hash:Hacl.Hash.Definitions.hash_st MD5 =
fun output input input_len -> Hacl.Hash.MD5.hash_oneshot output input input_len
false
FStar.Tactics.BV.fst
FStar.Tactics.BV.bv_tac_lt
val bv_tac_lt : n: Prims.int -> FStar.Tactics.Effect.Tac Prims.unit
let bv_tac_lt n = focus (fun () -> let nn = pack (Tv_Const (C_Int n)) in let t = mk_app (`trans_lt2) [(nn, Q_Implicit)] in apply_lemma t; arith_to_bv_tac (); arith_to_bv_tac (); set_options "--smtencoding.elim_box true"; smt () )
{ "file_name": "ulib/FStar.Tactics.BV.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 1, "end_line": 199, "start_col": 0, "start_line": 191 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.BV open FStar.Tactics.V2 open FStar.Reflection.V2.Formula open FStar.Reflection.V2.Arith open FStar.BV open FStar.UInt // using uint_t' instead of uint_t breaks the tactic (goes to inl). (* Congruence lemmas *) val cong_bvand : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvand #n w x == bvand #n y z) let cong_bvand #n #w #x #y #z pf1 pf2 = () val cong_bvxor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvxor w x == bvxor y z) let cong_bvxor #n #w #x #y #z pf1 pf2 = () val cong_bvor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvor w x == bvor y z) let cong_bvor #n #w #x #y #z pf1 pf2 = () val cong_bvshl : #n:pos -> (#w:bv_t n) -> (#x:uint_t n) -> (#y:bv_t n) -> squash (w == y) -> Lemma (bvshl w x == bvshl y x) let cong_bvshl #n #w #x #y pf = () val cong_bvshr : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvshr #n w x == bvshr #n y x) let cong_bvshr #n #w #x #y pf = () val cong_bvdiv : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvdiv #n w x == bvdiv #n y x) let cong_bvdiv #n #w #x #y pf = () val cong_bvmod : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmod #n w x == bvmod #n y x) let cong_bvmod #n #w #x #y pf = () val cong_bvmul : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmul #n w x == bvmul #n y x) let cong_bvmul #n #w #x #y pf = () val cong_bvadd : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvadd w x == bvadd y z) let cong_bvadd #n #w #x #y #z pf1 pf2 = () val cong_bvsub : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvsub w x == bvsub y z) let cong_bvsub #n #w #x #y #z pf1 pf2 = () (* Used to reduce the initial equation to an equation on bitvectors*) val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> squash (int2bv #n x == int2bv #n y) -> Lemma (x == y) let eq_to_bv #n #x #y pf = int2bv_lemma_2 #n x y val lt_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (b2t (bvult #n (int2bv #n x) (int2bv #n y))) -> Lemma (x < y) let lt_to_bv #n #x #y pf = int2bv_lemma_ult_2 #n x y (* Creates two fresh variables and two equations of the form int2bv x = z /\ int2bv y = w. The above lemmas transform these two equations before finally instantiating them through reflexivity, leaving Z3 to solve z = w *) val trans: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (x == z) -> squash (y == w) -> squash (z == w) -> Lemma (x == y) let trans #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> (eq2 #(bv_t n) x z) -> (eq2 #(bv_t n) y w) -> squash (bvult #n z w) -> Lemma (bvult #n x y) let trans_lt #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt2: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (int2bv #n x == z) -> squash (int2bv #n y == w) -> squash (bvult #n z w) -> Lemma (x < y) let trans_lt2 #n #x #y #z #w pf1 pf2 pf3 = int2bv_lemma_ult_2 x y let rec arith_expr_to_bv (e:expr) : Tac unit = match e with | NatToBv (MulMod e1 _) | MulMod e1 _ -> apply_lemma (`int2bv_mul); apply_lemma (`cong_bvmul); arith_expr_to_bv e1 | NatToBv (Umod e1 _) | Umod e1 _ -> apply_lemma (`int2bv_mod); apply_lemma (`cong_bvmod); arith_expr_to_bv e1 | NatToBv (Udiv e1 _) | Udiv e1 _ -> apply_lemma (`int2bv_div); apply_lemma (`cong_bvdiv); arith_expr_to_bv e1 | NatToBv (Shl e1 _) | Shl e1 _ -> apply_lemma (`int2bv_shl); apply_lemma (`cong_bvshl); arith_expr_to_bv e1 | NatToBv (Shr e1 _) | Shr e1 _ -> apply_lemma (`int2bv_shr); apply_lemma (`cong_bvshr); arith_expr_to_bv e1 | NatToBv (Land e1 e2) | (Land e1 e2) -> apply_lemma (`int2bv_logand); apply_lemma (`cong_bvand); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lxor e1 e2) | (Lxor e1 e2) -> apply_lemma (`int2bv_logxor); apply_lemma (`cong_bvxor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lor e1 e2) | (Lor e1 e2) -> apply_lemma (`int2bv_logor); apply_lemma (`cong_bvor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Ladd e1 e2) | (Ladd e1 e2) -> apply_lemma (`int2bv_add); apply_lemma (`cong_bvadd); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lsub e1 e2) | (Lsub e1 e2) -> apply_lemma (`int2bv_sub); apply_lemma (`cong_bvsub); arith_expr_to_bv e1; arith_expr_to_bv e2 | _ -> trefl () let arith_to_bv_tac () : Tac unit = focus (fun () -> norm [delta_only ["FStar.BV.bvult"]]; let g = cur_goal () in let f = term_as_formula g in match f with | Comp (Eq _) l r -> begin match run_tm (as_arith_expr l) with | Inl s -> dump s; trefl () | Inr e -> // dump "inr arith_to_bv"; seq (fun () -> arith_expr_to_bv e) trefl end | _ -> fail ("arith_to_bv_tac: unexpected: " ^ term_to_string g) ) (* As things are right now, we need to be able to parse NatToBv too. This can be useful, if we have mixed expressions so I'll leave it as is for now *) let bv_tac () = focus (fun () -> mapply (`eq_to_bv); mapply (`trans); arith_to_bv_tac (); arith_to_bv_tac (); set_options "--smtencoding.elim_box true"; norm [delta] ; smt () )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.Arith.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.BV.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.BV.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "FStar.BV", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Arith", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Formula", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.int -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.int", "FStar.Tactics.V2.Derived.focus", "Prims.unit", "FStar.Tactics.V2.Derived.smt", "FStar.Stubs.Tactics.V2.Builtins.set_options", "FStar.Tactics.BV.arith_to_bv_tac", "FStar.Tactics.V2.Derived.apply_lemma", "FStar.Stubs.Reflection.Types.term", "FStar.Reflection.V2.Derived.mk_app", "Prims.Cons", "FStar.Stubs.Reflection.V2.Data.argv", "FStar.Pervasives.Native.Mktuple2", "FStar.Stubs.Reflection.V2.Data.aqualv", "FStar.Stubs.Reflection.V2.Data.Q_Implicit", "Prims.Nil", "FStar.Tactics.NamedView.term", "FStar.Tactics.NamedView.pack", "FStar.Tactics.NamedView.Tv_Const", "FStar.Stubs.Reflection.V2.Data.C_Int" ]
[]
false
true
false
false
false
let bv_tac_lt n =
focus (fun () -> let nn = pack (Tv_Const (C_Int n)) in let t = mk_app (`trans_lt2) [(nn, Q_Implicit)] in apply_lemma t; arith_to_bv_tac (); arith_to_bv_tac (); set_options "--smtencoding.elim_box true"; smt ())
false
FStar.Tactics.BV.fst
FStar.Tactics.BV.bv_tac
val bv_tac : _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
let bv_tac () = focus (fun () -> mapply (`eq_to_bv); mapply (`trans); arith_to_bv_tac (); arith_to_bv_tac (); set_options "--smtencoding.elim_box true"; norm [delta] ; smt () )
{ "file_name": "ulib/FStar.Tactics.BV.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 1, "end_line": 189, "start_col": 0, "start_line": 181 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.BV open FStar.Tactics.V2 open FStar.Reflection.V2.Formula open FStar.Reflection.V2.Arith open FStar.BV open FStar.UInt // using uint_t' instead of uint_t breaks the tactic (goes to inl). (* Congruence lemmas *) val cong_bvand : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvand #n w x == bvand #n y z) let cong_bvand #n #w #x #y #z pf1 pf2 = () val cong_bvxor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvxor w x == bvxor y z) let cong_bvxor #n #w #x #y #z pf1 pf2 = () val cong_bvor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvor w x == bvor y z) let cong_bvor #n #w #x #y #z pf1 pf2 = () val cong_bvshl : #n:pos -> (#w:bv_t n) -> (#x:uint_t n) -> (#y:bv_t n) -> squash (w == y) -> Lemma (bvshl w x == bvshl y x) let cong_bvshl #n #w #x #y pf = () val cong_bvshr : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvshr #n w x == bvshr #n y x) let cong_bvshr #n #w #x #y pf = () val cong_bvdiv : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvdiv #n w x == bvdiv #n y x) let cong_bvdiv #n #w #x #y pf = () val cong_bvmod : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmod #n w x == bvmod #n y x) let cong_bvmod #n #w #x #y pf = () val cong_bvmul : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmul #n w x == bvmul #n y x) let cong_bvmul #n #w #x #y pf = () val cong_bvadd : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvadd w x == bvadd y z) let cong_bvadd #n #w #x #y #z pf1 pf2 = () val cong_bvsub : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvsub w x == bvsub y z) let cong_bvsub #n #w #x #y #z pf1 pf2 = () (* Used to reduce the initial equation to an equation on bitvectors*) val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> squash (int2bv #n x == int2bv #n y) -> Lemma (x == y) let eq_to_bv #n #x #y pf = int2bv_lemma_2 #n x y val lt_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (b2t (bvult #n (int2bv #n x) (int2bv #n y))) -> Lemma (x < y) let lt_to_bv #n #x #y pf = int2bv_lemma_ult_2 #n x y (* Creates two fresh variables and two equations of the form int2bv x = z /\ int2bv y = w. The above lemmas transform these two equations before finally instantiating them through reflexivity, leaving Z3 to solve z = w *) val trans: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (x == z) -> squash (y == w) -> squash (z == w) -> Lemma (x == y) let trans #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> (eq2 #(bv_t n) x z) -> (eq2 #(bv_t n) y w) -> squash (bvult #n z w) -> Lemma (bvult #n x y) let trans_lt #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt2: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (int2bv #n x == z) -> squash (int2bv #n y == w) -> squash (bvult #n z w) -> Lemma (x < y) let trans_lt2 #n #x #y #z #w pf1 pf2 pf3 = int2bv_lemma_ult_2 x y let rec arith_expr_to_bv (e:expr) : Tac unit = match e with | NatToBv (MulMod e1 _) | MulMod e1 _ -> apply_lemma (`int2bv_mul); apply_lemma (`cong_bvmul); arith_expr_to_bv e1 | NatToBv (Umod e1 _) | Umod e1 _ -> apply_lemma (`int2bv_mod); apply_lemma (`cong_bvmod); arith_expr_to_bv e1 | NatToBv (Udiv e1 _) | Udiv e1 _ -> apply_lemma (`int2bv_div); apply_lemma (`cong_bvdiv); arith_expr_to_bv e1 | NatToBv (Shl e1 _) | Shl e1 _ -> apply_lemma (`int2bv_shl); apply_lemma (`cong_bvshl); arith_expr_to_bv e1 | NatToBv (Shr e1 _) | Shr e1 _ -> apply_lemma (`int2bv_shr); apply_lemma (`cong_bvshr); arith_expr_to_bv e1 | NatToBv (Land e1 e2) | (Land e1 e2) -> apply_lemma (`int2bv_logand); apply_lemma (`cong_bvand); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lxor e1 e2) | (Lxor e1 e2) -> apply_lemma (`int2bv_logxor); apply_lemma (`cong_bvxor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lor e1 e2) | (Lor e1 e2) -> apply_lemma (`int2bv_logor); apply_lemma (`cong_bvor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Ladd e1 e2) | (Ladd e1 e2) -> apply_lemma (`int2bv_add); apply_lemma (`cong_bvadd); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lsub e1 e2) | (Lsub e1 e2) -> apply_lemma (`int2bv_sub); apply_lemma (`cong_bvsub); arith_expr_to_bv e1; arith_expr_to_bv e2 | _ -> trefl () let arith_to_bv_tac () : Tac unit = focus (fun () -> norm [delta_only ["FStar.BV.bvult"]]; let g = cur_goal () in let f = term_as_formula g in match f with | Comp (Eq _) l r -> begin match run_tm (as_arith_expr l) with | Inl s -> dump s; trefl () | Inr e -> // dump "inr arith_to_bv"; seq (fun () -> arith_expr_to_bv e) trefl end | _ -> fail ("arith_to_bv_tac: unexpected: " ^ term_to_string g) ) (* As things are right now, we need to be able to parse NatToBv too. This can be useful, if we have mixed expressions so I'll leave it
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.Arith.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.BV.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.BV.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "FStar.BV", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Arith", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Formula", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.focus", "FStar.Tactics.V2.Derived.smt", "FStar.Stubs.Tactics.V2.Builtins.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta", "Prims.Nil", "FStar.Stubs.Tactics.V2.Builtins.set_options", "FStar.Tactics.BV.arith_to_bv_tac", "FStar.Tactics.MApply.mapply", "FStar.Stubs.Reflection.Types.term", "FStar.Tactics.MApply.termable_term" ]
[]
false
true
false
false
false
let bv_tac () =
focus (fun () -> mapply (`eq_to_bv); mapply (`trans); arith_to_bv_tac (); arith_to_bv_tac (); set_options "--smtencoding.elim_box true"; norm [delta]; smt ())
false
EverCrypt.HMAC.fst
EverCrypt.HMAC.compute
val compute: a: supported_alg -> compute_st a
val compute: a: supported_alg -> compute_st a
let compute a mac key keylen data datalen = match a with | SHA1 -> compute_sha1 mac key keylen data datalen | SHA2_256 -> compute_sha2_256 mac key keylen data datalen | SHA2_384 -> compute_sha2_384 mac key keylen data datalen | SHA2_512 -> compute_sha2_512 mac key keylen data datalen | Blake2S -> compute_blake2s mac key keylen data datalen | Blake2B -> compute_blake2b mac key keylen data datalen
{ "file_name": "providers/evercrypt/fst/EverCrypt.HMAC.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 58, "end_line": 97, "start_col": 0, "start_line": 90 }
(* Agile HMAC *) module EverCrypt.HMAC open Hacl.HMAC // EverCrypt.Hash.Incremental.hash_256 is marked as private, so it is // inaccessible from here. Furthermore, the EverCrypt.Hash.Incremental module // does not have an interface, meaning that we can't even friend it! Writing an // interface for EverCrypt.Hash.Incremental is possible, but doesn't make much // sense: instantiations of the functor offer, by construction, an abstract // interface. Fortunately, we can use tactics to stealthily gain access to a // private definition that F* normally won't let us access. let super_hack () = let open FStar.Tactics in let hash_256 = [ "EverCrypt"; "Hash"; "Incremental"; "hash_256"] in let hash_256 = FStar.Tactics.pack_fv hash_256 in let hash_256 = pack (Tv_FVar hash_256) in let fv = pack_fv (cur_module () `FStar.List.Tot.append` [ "hash_256" ]) in let t: term = pack Tv_Unknown in let se = pack_sigelt (Sg_Let false [ pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = t; lb_def = hash_256 }) ]) in [ se ] %splice[hash_256] (super_hack ()) // Due to the hack above, the dependency arrow is invisible to the F* // parser/lexer, so we add an explicit dependency edge to avoid build errors. module Useless = EverCrypt.Hash.Incremental /// Four monomorphized variants, for callers who already know which algorithm they want (** @type: true *) val compute_sha1: compute_st SHA1 (** @type: true *) val compute_sha2_256: compute_st SHA2_256 (** @type: true *) val compute_sha2_384: compute_st SHA2_384 (** @type: true *) val compute_sha2_512: compute_st SHA2_512 (** @type: true *) val compute_blake2s: compute_st Blake2S (** @type: true *) val compute_blake2b: compute_st Blake2B let compute_sha1 = let open Hacl.Hash.SHA1 in mk_compute (|SHA1, ()|) hash_oneshot alloca init update_multi update_last finish (* This implementation calls into EverCrypt.Hash, which multiplexes between Hacl and Vale implementations of SHA2_256 functions depending on the static configuration and CPUID *) let compute_sha2_256 = let open Hacl.Hash.SHA2 in mk_compute (|SHA2_256, ()|) hash_256 alloca_256 init_256 EverCrypt.Hash.update_multi_256 update_last_256 finish_256 let compute_sha2_384 = let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (|SHA2_384, ()|) hash_384 alloca_384 init_384 update_multi_384 update_last_384 finish_384 let compute_sha2_512 = let open Hacl.Streaming.SHA2 in let open Hacl.Hash.SHA2 in mk_compute (|SHA2_512, ()|) hash_512 alloca_512 init_512 update_multi_512 update_last_512 finish_512 let compute_blake2s = let open Hacl.Hash.Blake2s_32 in mk_compute (|Blake2S, Hacl.Impl.Blake2.Core.M32|) hash alloca init update_multi update_last finish let compute_blake2b = let open Hacl.Hash.Blake2b_32 in mk_compute (|Blake2B, Hacl.Impl.Blake2.Core.M32|) hash alloca init update_multi update_last finish
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Streaming.SHA2.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "Hacl.HMAC.fsti.checked", "Hacl.Hash.SHA2.fsti.checked", "Hacl.Hash.SHA1.fsti.checked", "Hacl.Hash.Blake2s_32.fsti.checked", "Hacl.Hash.Blake2b_32.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.Incremental.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.HMAC.fst" }
[ { "abbrev": true, "full_module": "EverCrypt.Hash.Incremental", "short_module": "Useless" }, { "abbrev": false, "full_module": "Hacl.HMAC", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.HMAC", "short_module": null }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": 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
a: EverCrypt.HMAC.supported_alg -> Hacl.HMAC.compute_st a
Prims.Tot
[ "total" ]
[]
[ "EverCrypt.HMAC.supported_alg", "LowStar.Buffer.buffer", "Lib.IntTypes.uint8", "Prims.eq2", "Prims.nat", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "Spec.Hash.Definitions.hash_length", "Prims.l_and", "Spec.Agile.HMAC.keysized", "LowStar.Monotonic.Buffer.disjoint", "FStar.UInt32.t", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "FStar.UInt.size", "FStar.UInt32.n", "Prims.op_GreaterThanOrEqual", "FStar.UInt32.v", "Prims.op_LessThan", "Prims.op_Addition", "Spec.Hash.Definitions.block_length", "Prims.pow2", "EverCrypt.HMAC.compute_sha1", "Prims.unit", "EverCrypt.HMAC.compute_sha2_256", "EverCrypt.HMAC.compute_sha2_384", "EverCrypt.HMAC.compute_sha2_512", "EverCrypt.HMAC.compute_blake2s", "EverCrypt.HMAC.compute_blake2b" ]
[]
false
false
false
false
false
let compute a mac key keylen data datalen =
match a with | SHA1 -> compute_sha1 mac key keylen data datalen | SHA2_256 -> compute_sha2_256 mac key keylen data datalen | SHA2_384 -> compute_sha2_384 mac key keylen data datalen | SHA2_512 -> compute_sha2_512 mac key keylen data datalen | Blake2S -> compute_blake2s mac key keylen data datalen | Blake2B -> compute_blake2b mac key keylen data datalen
false
FStar.Tactics.BV.fst
FStar.Tactics.BV.to_bv_tac
val to_bv_tac : _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
let to_bv_tac () = focus (fun () -> apply_lemma (`eq_to_bv); apply_lemma (`trans); arith_to_bv_tac (); arith_to_bv_tac () )
{ "file_name": "ulib/FStar.Tactics.BV.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 1, "end_line": 206, "start_col": 0, "start_line": 201 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.BV open FStar.Tactics.V2 open FStar.Reflection.V2.Formula open FStar.Reflection.V2.Arith open FStar.BV open FStar.UInt // using uint_t' instead of uint_t breaks the tactic (goes to inl). (* Congruence lemmas *) val cong_bvand : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvand #n w x == bvand #n y z) let cong_bvand #n #w #x #y #z pf1 pf2 = () val cong_bvxor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvxor w x == bvxor y z) let cong_bvxor #n #w #x #y #z pf1 pf2 = () val cong_bvor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvor w x == bvor y z) let cong_bvor #n #w #x #y #z pf1 pf2 = () val cong_bvshl : #n:pos -> (#w:bv_t n) -> (#x:uint_t n) -> (#y:bv_t n) -> squash (w == y) -> Lemma (bvshl w x == bvshl y x) let cong_bvshl #n #w #x #y pf = () val cong_bvshr : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvshr #n w x == bvshr #n y x) let cong_bvshr #n #w #x #y pf = () val cong_bvdiv : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvdiv #n w x == bvdiv #n y x) let cong_bvdiv #n #w #x #y pf = () val cong_bvmod : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmod #n w x == bvmod #n y x) let cong_bvmod #n #w #x #y pf = () val cong_bvmul : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmul #n w x == bvmul #n y x) let cong_bvmul #n #w #x #y pf = () val cong_bvadd : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvadd w x == bvadd y z) let cong_bvadd #n #w #x #y #z pf1 pf2 = () val cong_bvsub : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvsub w x == bvsub y z) let cong_bvsub #n #w #x #y #z pf1 pf2 = () (* Used to reduce the initial equation to an equation on bitvectors*) val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> squash (int2bv #n x == int2bv #n y) -> Lemma (x == y) let eq_to_bv #n #x #y pf = int2bv_lemma_2 #n x y val lt_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (b2t (bvult #n (int2bv #n x) (int2bv #n y))) -> Lemma (x < y) let lt_to_bv #n #x #y pf = int2bv_lemma_ult_2 #n x y (* Creates two fresh variables and two equations of the form int2bv x = z /\ int2bv y = w. The above lemmas transform these two equations before finally instantiating them through reflexivity, leaving Z3 to solve z = w *) val trans: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (x == z) -> squash (y == w) -> squash (z == w) -> Lemma (x == y) let trans #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> (eq2 #(bv_t n) x z) -> (eq2 #(bv_t n) y w) -> squash (bvult #n z w) -> Lemma (bvult #n x y) let trans_lt #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt2: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (int2bv #n x == z) -> squash (int2bv #n y == w) -> squash (bvult #n z w) -> Lemma (x < y) let trans_lt2 #n #x #y #z #w pf1 pf2 pf3 = int2bv_lemma_ult_2 x y let rec arith_expr_to_bv (e:expr) : Tac unit = match e with | NatToBv (MulMod e1 _) | MulMod e1 _ -> apply_lemma (`int2bv_mul); apply_lemma (`cong_bvmul); arith_expr_to_bv e1 | NatToBv (Umod e1 _) | Umod e1 _ -> apply_lemma (`int2bv_mod); apply_lemma (`cong_bvmod); arith_expr_to_bv e1 | NatToBv (Udiv e1 _) | Udiv e1 _ -> apply_lemma (`int2bv_div); apply_lemma (`cong_bvdiv); arith_expr_to_bv e1 | NatToBv (Shl e1 _) | Shl e1 _ -> apply_lemma (`int2bv_shl); apply_lemma (`cong_bvshl); arith_expr_to_bv e1 | NatToBv (Shr e1 _) | Shr e1 _ -> apply_lemma (`int2bv_shr); apply_lemma (`cong_bvshr); arith_expr_to_bv e1 | NatToBv (Land e1 e2) | (Land e1 e2) -> apply_lemma (`int2bv_logand); apply_lemma (`cong_bvand); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lxor e1 e2) | (Lxor e1 e2) -> apply_lemma (`int2bv_logxor); apply_lemma (`cong_bvxor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lor e1 e2) | (Lor e1 e2) -> apply_lemma (`int2bv_logor); apply_lemma (`cong_bvor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Ladd e1 e2) | (Ladd e1 e2) -> apply_lemma (`int2bv_add); apply_lemma (`cong_bvadd); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lsub e1 e2) | (Lsub e1 e2) -> apply_lemma (`int2bv_sub); apply_lemma (`cong_bvsub); arith_expr_to_bv e1; arith_expr_to_bv e2 | _ -> trefl () let arith_to_bv_tac () : Tac unit = focus (fun () -> norm [delta_only ["FStar.BV.bvult"]]; let g = cur_goal () in let f = term_as_formula g in match f with | Comp (Eq _) l r -> begin match run_tm (as_arith_expr l) with | Inl s -> dump s; trefl () | Inr e -> // dump "inr arith_to_bv"; seq (fun () -> arith_expr_to_bv e) trefl end | _ -> fail ("arith_to_bv_tac: unexpected: " ^ term_to_string g) ) (* As things are right now, we need to be able to parse NatToBv too. This can be useful, if we have mixed expressions so I'll leave it as is for now *) let bv_tac () = focus (fun () -> mapply (`eq_to_bv); mapply (`trans); arith_to_bv_tac (); arith_to_bv_tac (); set_options "--smtencoding.elim_box true"; norm [delta] ; smt () ) let bv_tac_lt n = focus (fun () -> let nn = pack (Tv_Const (C_Int n)) in let t = mk_app (`trans_lt2) [(nn, Q_Implicit)] in apply_lemma t; arith_to_bv_tac (); arith_to_bv_tac (); set_options "--smtencoding.elim_box true"; smt () )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.Arith.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.BV.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.BV.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "FStar.BV", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Arith", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Formula", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.focus", "FStar.Tactics.BV.arith_to_bv_tac", "FStar.Tactics.V2.Derived.apply_lemma" ]
[]
false
true
false
false
false
let to_bv_tac () =
focus (fun () -> apply_lemma (`eq_to_bv); apply_lemma (`trans); arith_to_bv_tac (); arith_to_bv_tac ())
false
Hacl.Hash.MD.fst
Hacl.Hash.MD.pad_length_mod
val pad_length_mod (a: hash_alg{is_md a}) (base_len len: nat) : Lemma (requires base_len % block_length a = 0) (ensures pad_length a (base_len + len) = pad_length a len)
val pad_length_mod (a: hash_alg{is_md a}) (base_len len: nat) : Lemma (requires base_len % block_length a = 0) (ensures pad_length a (base_len + len) = pad_length a len)
let pad_length_mod (a: hash_alg{is_md a}) (base_len len: nat): Lemma (requires base_len % block_length a = 0) (ensures pad_length a (base_len + len) = pad_length a len) = pad0_length_mod a base_len len
{ "file_name": "code/hash/Hacl.Hash.MD.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 62, "start_col": 0, "start_line": 59 }
module Hacl.Hash.MD (** The Merkle-Damgård construction. *) module U8 = FStar.UInt8 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module U128 = FStar.UInt128 module Int = Lib.IntTypes module Lemmas = FStar.Math.Lemmas module B = LowStar.Buffer module S = FStar.Seq module HS = FStar.HyperStack module ST = FStar.HyperStack.ST open Hacl.Hash.Definitions open Hacl.Hash.Lemmas open Spec.Hash.Definitions open FStar.Mul module HI = Spec.Hash.Incremental module AH = Spec.Agile.Hash (** Auxiliary helpers *) #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let padding_round (a: md_alg) (len: len_t a): Lemma ((len_v a len + pad_length a (len_v a len)) % block_length a = 0) = () private val mod_sub_add: a:int -> b:int -> c:int -> d:int -> p:pos -> Lemma (requires b % p = 0) (ensures (a - ((b + c) + d)) % p == (a - (c + d)) % p) let mod_sub_add a b c d p = calc (==) { (a - ((b + c) + d)) % p; == { Math.Lemmas.lemma_mod_sub_distr a ((b + c) + d) p } (a - ((b + c) + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l (b + c) d p } (a - ((b + c) % p + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l b c p } (a - ((b % p + c) % p + d) % p) % p; == { } (a - (c % p + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l c d p } (a - (c + d) % p) % p; == { Math.Lemmas.lemma_mod_sub_distr a (c + d) p } (a - (c + d)) % p; } let pad0_length_mod (a: hash_alg{is_md a}) (base_len: nat) (len: nat): Lemma (requires base_len % block_length a = 0) (ensures pad0_length a (base_len + len) = pad0_length a len) = mod_sub_add (block_length a) base_len len (len_length a + 1) (block_length a)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.MD.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Incremental.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fst.checked", "Spec.Agile.Hash.fst.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.IntTypes.fsti.checked", "Hacl.Hash.PadFinish.fsti.checked", "Hacl.Hash.Lemmas.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt128.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.Int.Cast.Full.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Calc.fsti.checked", "C.Loops.fst.checked" ], "interface_file": true, "source_file": "Hacl.Hash.MD.fst" }
[ { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "AH" }, { "abbrev": true, "full_module": "Spec.Hash.Incremental", "short_module": "HI" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.Math.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.IntTypes", "short_module": "Int" }, { "abbrev": true, "full_module": "FStar.UInt128", "short_module": "U128" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Spec.Hash.Definitions.hash_alg{Spec.Hash.Definitions.is_md a} -> base_len: Prims.nat -> len: Prims.nat -> FStar.Pervasives.Lemma (requires base_len % Spec.Hash.Definitions.block_length a = 0) (ensures Spec.Hash.Definitions.pad_length a (base_len + len) = Spec.Hash.Definitions.pad_length a len )
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Spec.Hash.Definitions.hash_alg", "Prims.b2t", "Spec.Hash.Definitions.is_md", "Prims.nat", "Hacl.Hash.MD.pad0_length_mod", "Prims.unit", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "Spec.Hash.Definitions.block_length", "Prims.squash", "Prims.l_or", "Prims.op_Addition", "Spec.Hash.Definitions.pad_length", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let pad_length_mod (a: hash_alg{is_md a}) (base_len len: nat) : Lemma (requires base_len % block_length a = 0) (ensures pad_length a (base_len + len) = pad_length a len) =
pad0_length_mod a base_len len
false
FStar.Tactics.BV.fst
FStar.Tactics.BV.arith_expr_to_bv
val arith_expr_to_bv (e: expr) : Tac unit
val arith_expr_to_bv (e: expr) : Tac unit
let rec arith_expr_to_bv (e:expr) : Tac unit = match e with | NatToBv (MulMod e1 _) | MulMod e1 _ -> apply_lemma (`int2bv_mul); apply_lemma (`cong_bvmul); arith_expr_to_bv e1 | NatToBv (Umod e1 _) | Umod e1 _ -> apply_lemma (`int2bv_mod); apply_lemma (`cong_bvmod); arith_expr_to_bv e1 | NatToBv (Udiv e1 _) | Udiv e1 _ -> apply_lemma (`int2bv_div); apply_lemma (`cong_bvdiv); arith_expr_to_bv e1 | NatToBv (Shl e1 _) | Shl e1 _ -> apply_lemma (`int2bv_shl); apply_lemma (`cong_bvshl); arith_expr_to_bv e1 | NatToBv (Shr e1 _) | Shr e1 _ -> apply_lemma (`int2bv_shr); apply_lemma (`cong_bvshr); arith_expr_to_bv e1 | NatToBv (Land e1 e2) | (Land e1 e2) -> apply_lemma (`int2bv_logand); apply_lemma (`cong_bvand); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lxor e1 e2) | (Lxor e1 e2) -> apply_lemma (`int2bv_logxor); apply_lemma (`cong_bvxor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lor e1 e2) | (Lor e1 e2) -> apply_lemma (`int2bv_logor); apply_lemma (`cong_bvor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Ladd e1 e2) | (Ladd e1 e2) -> apply_lemma (`int2bv_add); apply_lemma (`cong_bvadd); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lsub e1 e2) | (Lsub e1 e2) -> apply_lemma (`int2bv_sub); apply_lemma (`cong_bvsub); arith_expr_to_bv e1; arith_expr_to_bv e2 | _ -> trefl ()
{ "file_name": "ulib/FStar.Tactics.BV.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 16, "end_line": 158, "start_col": 0, "start_line": 110 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.BV open FStar.Tactics.V2 open FStar.Reflection.V2.Formula open FStar.Reflection.V2.Arith open FStar.BV open FStar.UInt // using uint_t' instead of uint_t breaks the tactic (goes to inl). (* Congruence lemmas *) val cong_bvand : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvand #n w x == bvand #n y z) let cong_bvand #n #w #x #y #z pf1 pf2 = () val cong_bvxor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvxor w x == bvxor y z) let cong_bvxor #n #w #x #y #z pf1 pf2 = () val cong_bvor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvor w x == bvor y z) let cong_bvor #n #w #x #y #z pf1 pf2 = () val cong_bvshl : #n:pos -> (#w:bv_t n) -> (#x:uint_t n) -> (#y:bv_t n) -> squash (w == y) -> Lemma (bvshl w x == bvshl y x) let cong_bvshl #n #w #x #y pf = () val cong_bvshr : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvshr #n w x == bvshr #n y x) let cong_bvshr #n #w #x #y pf = () val cong_bvdiv : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvdiv #n w x == bvdiv #n y x) let cong_bvdiv #n #w #x #y pf = () val cong_bvmod : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmod #n w x == bvmod #n y x) let cong_bvmod #n #w #x #y pf = () val cong_bvmul : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmul #n w x == bvmul #n y x) let cong_bvmul #n #w #x #y pf = () val cong_bvadd : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvadd w x == bvadd y z) let cong_bvadd #n #w #x #y #z pf1 pf2 = () val cong_bvsub : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvsub w x == bvsub y z) let cong_bvsub #n #w #x #y #z pf1 pf2 = () (* Used to reduce the initial equation to an equation on bitvectors*) val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> squash (int2bv #n x == int2bv #n y) -> Lemma (x == y) let eq_to_bv #n #x #y pf = int2bv_lemma_2 #n x y val lt_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (b2t (bvult #n (int2bv #n x) (int2bv #n y))) -> Lemma (x < y) let lt_to_bv #n #x #y pf = int2bv_lemma_ult_2 #n x y (* Creates two fresh variables and two equations of the form int2bv x = z /\ int2bv y = w. The above lemmas transform these two equations before finally instantiating them through reflexivity, leaving Z3 to solve z = w *) val trans: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (x == z) -> squash (y == w) -> squash (z == w) -> Lemma (x == y) let trans #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> (eq2 #(bv_t n) x z) -> (eq2 #(bv_t n) y w) -> squash (bvult #n z w) -> Lemma (bvult #n x y) let trans_lt #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt2: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (int2bv #n x == z) -> squash (int2bv #n y == w) -> squash (bvult #n z w) -> Lemma (x < y) let trans_lt2 #n #x #y #z #w pf1 pf2 pf3 = int2bv_lemma_ult_2 x y
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.Arith.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.BV.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.BV.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "FStar.BV", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Arith", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Formula", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
e: FStar.Reflection.V2.Arith.expr -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Reflection.V2.Arith.expr", "FStar.Tactics.BV.arith_expr_to_bv", "Prims.unit", "FStar.Tactics.V2.Derived.apply_lemma", "FStar.Tactics.V2.Derived.trefl" ]
[ "recursion" ]
false
true
false
false
false
let rec arith_expr_to_bv (e: expr) : Tac unit =
match e with | NatToBv (MulMod e1 _) | MulMod e1 _ -> apply_lemma (`int2bv_mul); apply_lemma (`cong_bvmul); arith_expr_to_bv e1 | NatToBv (Umod e1 _) | Umod e1 _ -> apply_lemma (`int2bv_mod); apply_lemma (`cong_bvmod); arith_expr_to_bv e1 | NatToBv (Udiv e1 _) | Udiv e1 _ -> apply_lemma (`int2bv_div); apply_lemma (`cong_bvdiv); arith_expr_to_bv e1 | NatToBv (Shl e1 _) | Shl e1 _ -> apply_lemma (`int2bv_shl); apply_lemma (`cong_bvshl); arith_expr_to_bv e1 | NatToBv (Shr e1 _) | Shr e1 _ -> apply_lemma (`int2bv_shr); apply_lemma (`cong_bvshr); arith_expr_to_bv e1 | NatToBv (Land e1 e2) | Land e1 e2 -> apply_lemma (`int2bv_logand); apply_lemma (`cong_bvand); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lxor e1 e2) | Lxor e1 e2 -> apply_lemma (`int2bv_logxor); apply_lemma (`cong_bvxor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lor e1 e2) | Lor e1 e2 -> apply_lemma (`int2bv_logor); apply_lemma (`cong_bvor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Ladd e1 e2) | Ladd e1 e2 -> apply_lemma (`int2bv_add); apply_lemma (`cong_bvadd); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lsub e1 e2) | Lsub e1 e2 -> apply_lemma (`int2bv_sub); apply_lemma (`cong_bvsub); arith_expr_to_bv e1; arith_expr_to_bv e2 | _ -> trefl ()
false
FStar.Tactics.BV.fst
FStar.Tactics.BV.lt_to_bv
val lt_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (b2t (bvult #n (int2bv #n x) (int2bv #n y))) -> Lemma (x < y)
val lt_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (b2t (bvult #n (int2bv #n x) (int2bv #n y))) -> Lemma (x < y)
let lt_to_bv #n #x #y pf = int2bv_lemma_ult_2 #n x y
{ "file_name": "ulib/FStar.Tactics.BV.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 52, "end_line": 89, "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 FStar.Tactics.BV open FStar.Tactics.V2 open FStar.Reflection.V2.Formula open FStar.Reflection.V2.Arith open FStar.BV open FStar.UInt // using uint_t' instead of uint_t breaks the tactic (goes to inl). (* Congruence lemmas *) val cong_bvand : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvand #n w x == bvand #n y z) let cong_bvand #n #w #x #y #z pf1 pf2 = () val cong_bvxor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvxor w x == bvxor y z) let cong_bvxor #n #w #x #y #z pf1 pf2 = () val cong_bvor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvor w x == bvor y z) let cong_bvor #n #w #x #y #z pf1 pf2 = () val cong_bvshl : #n:pos -> (#w:bv_t n) -> (#x:uint_t n) -> (#y:bv_t n) -> squash (w == y) -> Lemma (bvshl w x == bvshl y x) let cong_bvshl #n #w #x #y pf = () val cong_bvshr : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvshr #n w x == bvshr #n y x) let cong_bvshr #n #w #x #y pf = () val cong_bvdiv : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvdiv #n w x == bvdiv #n y x) let cong_bvdiv #n #w #x #y pf = () val cong_bvmod : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmod #n w x == bvmod #n y x) let cong_bvmod #n #w #x #y pf = () val cong_bvmul : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmul #n w x == bvmul #n y x) let cong_bvmul #n #w #x #y pf = () val cong_bvadd : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvadd w x == bvadd y z) let cong_bvadd #n #w #x #y #z pf1 pf2 = () val cong_bvsub : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvsub w x == bvsub y z) let cong_bvsub #n #w #x #y #z pf1 pf2 = () (* Used to reduce the initial equation to an equation on bitvectors*) val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> squash (int2bv #n x == int2bv #n y) -> Lemma (x == y) let eq_to_bv #n #x #y pf = int2bv_lemma_2 #n x y val lt_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) ->
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.Arith.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.BV.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.BV.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "FStar.BV", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Arith", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Formula", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
pf: FStar.BV.bvult (FStar.BV.int2bv x) (FStar.BV.int2bv y) -> FStar.Pervasives.Lemma (ensures x < y)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.pos", "FStar.UInt.uint_t", "Prims.b2t", "FStar.BV.bvult", "FStar.BV.int2bv", "FStar.BV.int2bv_lemma_ult_2", "Prims.unit" ]
[]
true
false
true
false
false
let lt_to_bv #n #x #y pf =
int2bv_lemma_ult_2 #n x y
false
FStar.Tactics.BV.fst
FStar.Tactics.BV.eq_to_bv
val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> squash (int2bv #n x == int2bv #n y) -> Lemma (x == y)
val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> squash (int2bv #n x == int2bv #n y) -> Lemma (x == y)
let eq_to_bv #n #x #y pf = int2bv_lemma_2 #n x y
{ "file_name": "ulib/FStar.Tactics.BV.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 48, "end_line": 85, "start_col": 0, "start_line": 85 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.BV open FStar.Tactics.V2 open FStar.Reflection.V2.Formula open FStar.Reflection.V2.Arith open FStar.BV open FStar.UInt // using uint_t' instead of uint_t breaks the tactic (goes to inl). (* Congruence lemmas *) val cong_bvand : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvand #n w x == bvand #n y z) let cong_bvand #n #w #x #y #z pf1 pf2 = () val cong_bvxor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvxor w x == bvxor y z) let cong_bvxor #n #w #x #y #z pf1 pf2 = () val cong_bvor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvor w x == bvor y z) let cong_bvor #n #w #x #y #z pf1 pf2 = () val cong_bvshl : #n:pos -> (#w:bv_t n) -> (#x:uint_t n) -> (#y:bv_t n) -> squash (w == y) -> Lemma (bvshl w x == bvshl y x) let cong_bvshl #n #w #x #y pf = () val cong_bvshr : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvshr #n w x == bvshr #n y x) let cong_bvshr #n #w #x #y pf = () val cong_bvdiv : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvdiv #n w x == bvdiv #n y x) let cong_bvdiv #n #w #x #y pf = () val cong_bvmod : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmod #n w x == bvmod #n y x) let cong_bvmod #n #w #x #y pf = () val cong_bvmul : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmul #n w x == bvmul #n y x) let cong_bvmul #n #w #x #y pf = () val cong_bvadd : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvadd w x == bvadd y z) let cong_bvadd #n #w #x #y #z pf1 pf2 = () val cong_bvsub : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvsub w x == bvsub y z) let cong_bvsub #n #w #x #y #z pf1 pf2 = () (* Used to reduce the initial equation to an equation on bitvectors*) val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) ->
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.Arith.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.BV.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.BV.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "FStar.BV", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Arith", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Formula", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
pf: Prims.squash (FStar.BV.int2bv x == FStar.BV.int2bv y) -> FStar.Pervasives.Lemma (ensures x == y)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.pos", "FStar.UInt.uint_t", "Prims.squash", "Prims.eq2", "FStar.BV.bv_t", "FStar.BV.int2bv", "FStar.BV.int2bv_lemma_2", "Prims.unit" ]
[]
true
false
true
false
false
let eq_to_bv #n #x #y pf =
int2bv_lemma_2 #n x y
false
C.Loops.fst
C.Loops.for64
val for64: start:UInt64.t -> finish:UInt64.t{UInt64.v finish >= UInt64.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt64.t{UInt64.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt64.v i))) (ensures (fun h_1 _ h_2 -> UInt64.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt64.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt64.v finish)))
val for64: start:UInt64.t -> finish:UInt64.t{UInt64.v finish >= UInt64.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt64.t{UInt64.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt64.v i))) (ensures (fun h_1 _ h_2 -> UInt64.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt64.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt64.v finish)))
let rec for64 start finish inv f = if start = finish then () else begin f start; for64 (UInt64.(start +^ 1UL)) finish inv f end
{ "file_name": "krmllib/C.Loops.fst", "git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321", "git_url": "https://github.com/FStarLang/karamel.git", "project_name": "karamel" }
{ "end_col": 5, "end_line": 78, "start_col": 0, "start_line": 72 }
(* This module exposes a series of combinators; they are modeled using * higher-order functions and specifications, and extracted, using a * meta-theoretic argument, to actual C loops. *) module C.Loops open FStar.HyperStack.ST open LowStar.Buffer open LowStar.BufferOps module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module UInt32 = FStar.UInt32 module UInt64 = FStar.UInt64 include Spec.Loops module Buffer = LowStar.Buffer #set-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20" (** The functions in this module use the following convention: * - the first arguments are buffers; * - the destination buffer comes first, followed by the input buffer (as in * C's memcpy) * - each buffer is followed by its length; if several buffers share the same * length, there is a single length argument after the buffers * - the function-specific arguments come next (e.g. the number of times one * may want to call the function in [repeat]) * - the second to last argument is the loop invariant (which may have * dependencies on all the parameters before) * - the last argument is the loop body (that will depend on the invariant, and * possibly all the other parameters before. *) (* Generic-purpose for-loop combinators ***************************************) (* These combinators enjoy first-class support in KaRaMeL. (See [combinators] in * src/Simplify.ml *) (* Currently extracting as: for (int i = <start>; i != <finish>; ++i) <f> i; *) val for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec for start finish inv f = if start = finish then () else begin f start; for (UInt32.(start +^ 1ul)) finish inv f end val for64: start:UInt64.t -> finish:UInt64.t{UInt64.v finish >= UInt64.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt64.t{UInt64.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt64.v i))) (ensures (fun h_1 _ h_2 -> UInt64.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt64.v start)))
{ "checked_file": "/", "dependencies": [ "Spec.Loops.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "C.Loops.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "Buffer" }, { "abbrev": false, "full_module": "Spec.Loops", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "UInt64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "UInt32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
start: FStar.UInt64.t -> finish: FStar.UInt64.t{FStar.UInt64.v finish >= FStar.UInt64.v start} -> inv: (_: FStar.Monotonic.HyperStack.mem -> _: Prims.nat -> Type0) -> f: ( i: FStar.UInt64.t { FStar.UInt64.v start <= FStar.UInt64.v i /\ FStar.UInt64.v i < FStar.UInt64.v finish } -> FStar.HyperStack.ST.Stack Prims.unit) -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "FStar.UInt64.t", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.UInt64.v", "FStar.Monotonic.HyperStack.mem", "Prims.nat", "Prims.l_and", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Prims.unit", "Prims.op_Addition", "Prims.op_Equality", "Prims.bool", "C.Loops.for64", "FStar.UInt64.op_Plus_Hat", "FStar.UInt64.__uint_to_t" ]
[ "recursion" ]
false
true
false
false
false
let rec for64 start finish inv f =
if start = finish then () else (f start; for64 (let open UInt64 in start +^ 1uL) finish inv f)
false
Hacl.Hash.MD.fst
Hacl.Hash.MD.pad0_length_mod
val pad0_length_mod (a: hash_alg{is_md a}) (base_len len: nat) : Lemma (requires base_len % block_length a = 0) (ensures pad0_length a (base_len + len) = pad0_length a len)
val pad0_length_mod (a: hash_alg{is_md a}) (base_len len: nat) : Lemma (requires base_len % block_length a = 0) (ensures pad0_length a (base_len + len) = pad0_length a len)
let pad0_length_mod (a: hash_alg{is_md a}) (base_len: nat) (len: nat): Lemma (requires base_len % block_length a = 0) (ensures pad0_length a (base_len + len) = pad0_length a len) = mod_sub_add (block_length a) base_len len (len_length a + 1) (block_length a)
{ "file_name": "code/hash/Hacl.Hash.MD.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 79, "end_line": 57, "start_col": 0, "start_line": 53 }
module Hacl.Hash.MD (** The Merkle-Damgård construction. *) module U8 = FStar.UInt8 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module U128 = FStar.UInt128 module Int = Lib.IntTypes module Lemmas = FStar.Math.Lemmas module B = LowStar.Buffer module S = FStar.Seq module HS = FStar.HyperStack module ST = FStar.HyperStack.ST open Hacl.Hash.Definitions open Hacl.Hash.Lemmas open Spec.Hash.Definitions open FStar.Mul module HI = Spec.Hash.Incremental module AH = Spec.Agile.Hash (** Auxiliary helpers *) #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let padding_round (a: md_alg) (len: len_t a): Lemma ((len_v a len + pad_length a (len_v a len)) % block_length a = 0) = () private val mod_sub_add: a:int -> b:int -> c:int -> d:int -> p:pos -> Lemma (requires b % p = 0) (ensures (a - ((b + c) + d)) % p == (a - (c + d)) % p) let mod_sub_add a b c d p = calc (==) { (a - ((b + c) + d)) % p; == { Math.Lemmas.lemma_mod_sub_distr a ((b + c) + d) p } (a - ((b + c) + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l (b + c) d p } (a - ((b + c) % p + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l b c p } (a - ((b % p + c) % p + d) % p) % p; == { } (a - (c % p + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l c d p } (a - (c + d) % p) % p; == { Math.Lemmas.lemma_mod_sub_distr a (c + d) p } (a - (c + d)) % p; }
{ "checked_file": "/", "dependencies": [ "Spec.Hash.MD.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Incremental.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fst.checked", "Spec.Agile.Hash.fst.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.IntTypes.fsti.checked", "Hacl.Hash.PadFinish.fsti.checked", "Hacl.Hash.Lemmas.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt128.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.Int.Cast.Full.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Calc.fsti.checked", "C.Loops.fst.checked" ], "interface_file": true, "source_file": "Hacl.Hash.MD.fst" }
[ { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "AH" }, { "abbrev": true, "full_module": "Spec.Hash.Incremental", "short_module": "HI" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.Math.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.IntTypes", "short_module": "Int" }, { "abbrev": true, "full_module": "FStar.UInt128", "short_module": "U128" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Spec.Hash.Definitions.hash_alg{Spec.Hash.Definitions.is_md a} -> base_len: Prims.nat -> len: Prims.nat -> FStar.Pervasives.Lemma (requires base_len % Spec.Hash.Definitions.block_length a = 0) (ensures Spec.Hash.Definitions.pad0_length a (base_len + len) = Spec.Hash.Definitions.pad0_length a len)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Spec.Hash.Definitions.hash_alg", "Prims.b2t", "Spec.Hash.Definitions.is_md", "Prims.nat", "Hacl.Hash.MD.mod_sub_add", "Spec.Hash.Definitions.block_length", "Prims.op_Addition", "Spec.Hash.Definitions.len_length", "Prims.unit", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "Prims.squash", "Prims.l_or", "Spec.Hash.Definitions.pad0_length", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let pad0_length_mod (a: hash_alg{is_md a}) (base_len len: nat) : Lemma (requires base_len % block_length a = 0) (ensures pad0_length a (base_len + len) = pad0_length a len) =
mod_sub_add (block_length a) base_len len (len_length a + 1) (block_length a)
false
C.Loops.fst
C.Loops.reverse_for
val reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i - 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish)))
val reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i - 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish)))
let rec reverse_for start finish inv f = if start = finish then () else begin f start; reverse_for (UInt32.(start -^ 1ul)) finish inv f end
{ "file_name": "krmllib/C.Loops.fst", "git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321", "git_url": "https://github.com/FStarLang/karamel.git", "project_name": "karamel" }
{ "end_col": 5, "end_line": 101, "start_col": 0, "start_line": 95 }
(* This module exposes a series of combinators; they are modeled using * higher-order functions and specifications, and extracted, using a * meta-theoretic argument, to actual C loops. *) module C.Loops open FStar.HyperStack.ST open LowStar.Buffer open LowStar.BufferOps module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module UInt32 = FStar.UInt32 module UInt64 = FStar.UInt64 include Spec.Loops module Buffer = LowStar.Buffer #set-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20" (** The functions in this module use the following convention: * - the first arguments are buffers; * - the destination buffer comes first, followed by the input buffer (as in * C's memcpy) * - each buffer is followed by its length; if several buffers share the same * length, there is a single length argument after the buffers * - the function-specific arguments come next (e.g. the number of times one * may want to call the function in [repeat]) * - the second to last argument is the loop invariant (which may have * dependencies on all the parameters before) * - the last argument is the loop body (that will depend on the invariant, and * possibly all the other parameters before. *) (* Generic-purpose for-loop combinators ***************************************) (* These combinators enjoy first-class support in KaRaMeL. (See [combinators] in * src/Simplify.ml *) (* Currently extracting as: for (int i = <start>; i != <finish>; ++i) <f> i; *) val for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec for start finish inv f = if start = finish then () else begin f start; for (UInt32.(start +^ 1ul)) finish inv f end val for64: start:UInt64.t -> finish:UInt64.t{UInt64.v finish >= UInt64.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt64.t{UInt64.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt64.v i))) (ensures (fun h_1 _ h_2 -> UInt64.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt64.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt64.v finish))) let rec for64 start finish inv f = if start = finish then () else begin f start; for64 (UInt64.(start +^ 1UL)) finish inv f end (* To be extracted as: for (int i = <start>; i != <finish>; --i) <f> i; *) val reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i - 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start)))
{ "checked_file": "/", "dependencies": [ "Spec.Loops.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "C.Loops.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "Buffer" }, { "abbrev": false, "full_module": "Spec.Loops", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "UInt64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "UInt32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
start: FStar.UInt32.t -> finish: FStar.UInt32.t{FStar.UInt32.v finish <= FStar.UInt32.v start} -> inv: (_: FStar.Monotonic.HyperStack.mem -> _: Prims.nat -> Type0) -> f: ( i: FStar.UInt32.t { FStar.UInt32.v start >= FStar.UInt32.v i /\ FStar.UInt32.v i > FStar.UInt32.v finish } -> FStar.HyperStack.ST.Stack Prims.unit) -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "FStar.UInt32.t", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "FStar.Monotonic.HyperStack.mem", "Prims.nat", "Prims.l_and", "Prims.op_GreaterThanOrEqual", "Prims.op_GreaterThan", "Prims.unit", "Prims.op_Subtraction", "Prims.op_Equality", "Prims.bool", "C.Loops.reverse_for", "FStar.UInt32.op_Subtraction_Hat", "FStar.UInt32.__uint_to_t" ]
[ "recursion" ]
false
true
false
false
false
let rec reverse_for start finish inv f =
if start = finish then () else (f start; reverse_for (let open UInt32 in start -^ 1ul) finish inv f)
false
C.Loops.fst
C.Loops.while
val while: #test_pre: (HS.mem -> GTot Type0) -> #test_post: (bool -> HS.mem -> GTot Type0) -> $test: (unit -> Stack bool (requires (fun h -> test_pre h)) (ensures (fun h0 x h1 -> test_post x h1))) -> body: (unit -> Stack unit (requires (fun h -> test_post true h)) (ensures (fun h0 _ h1 -> test_pre h1))) -> Stack unit (requires (fun h -> test_pre h)) (ensures (fun h0 _ h1 -> test_post false h1))
val while: #test_pre: (HS.mem -> GTot Type0) -> #test_post: (bool -> HS.mem -> GTot Type0) -> $test: (unit -> Stack bool (requires (fun h -> test_pre h)) (ensures (fun h0 x h1 -> test_post x h1))) -> body: (unit -> Stack unit (requires (fun h -> test_post true h)) (ensures (fun h0 _ h1 -> test_pre h1))) -> Stack unit (requires (fun h -> test_pre h)) (ensures (fun h0 _ h1 -> test_post false h1))
let rec while #test_pre #test_post test body = if test () then begin body (); while #test_pre #test_post test body end
{ "file_name": "krmllib/C.Loops.fst", "git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321", "git_url": "https://github.com/FStarLang/karamel.git", "project_name": "karamel" }
{ "end_col": 5, "end_line": 172, "start_col": 0, "start_line": 168 }
(* This module exposes a series of combinators; they are modeled using * higher-order functions and specifications, and extracted, using a * meta-theoretic argument, to actual C loops. *) module C.Loops open FStar.HyperStack.ST open LowStar.Buffer open LowStar.BufferOps module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module UInt32 = FStar.UInt32 module UInt64 = FStar.UInt64 include Spec.Loops module Buffer = LowStar.Buffer #set-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20" (** The functions in this module use the following convention: * - the first arguments are buffers; * - the destination buffer comes first, followed by the input buffer (as in * C's memcpy) * - each buffer is followed by its length; if several buffers share the same * length, there is a single length argument after the buffers * - the function-specific arguments come next (e.g. the number of times one * may want to call the function in [repeat]) * - the second to last argument is the loop invariant (which may have * dependencies on all the parameters before) * - the last argument is the loop body (that will depend on the invariant, and * possibly all the other parameters before. *) (* Generic-purpose for-loop combinators ***************************************) (* These combinators enjoy first-class support in KaRaMeL. (See [combinators] in * src/Simplify.ml *) (* Currently extracting as: for (int i = <start>; i != <finish>; ++i) <f> i; *) val for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec for start finish inv f = if start = finish then () else begin f start; for (UInt32.(start +^ 1ul)) finish inv f end val for64: start:UInt64.t -> finish:UInt64.t{UInt64.v finish >= UInt64.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt64.t{UInt64.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt64.v i))) (ensures (fun h_1 _ h_2 -> UInt64.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt64.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt64.v finish))) let rec for64 start finish inv f = if start = finish then () else begin f start; for64 (UInt64.(start +^ 1UL)) finish inv f end (* To be extracted as: for (int i = <start>; i != <finish>; --i) <f> i; *) val reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i - 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec reverse_for start finish inv f = if start = finish then () else begin f start; reverse_for (UInt32.(start -^ 1ul)) finish inv f end (* To be extracted as: bool b = false; int i = <start>; for (; (!b) && (i != <end>); ++i) { b = <f> i; } (i, b) *) val interruptible_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> bool -> GTot Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack bool (requires (fun h -> inv h (UInt32.v i) false)) (ensures (fun h_1 b h_2 -> inv h_1 (UInt32.v i) false /\ inv h_2 UInt32.(v i + 1) b)) ) -> Stack (UInt32.t * bool) (requires (fun h -> inv h (UInt32.v start) false)) (ensures (fun _ res h_2 -> let (i, b) = res in ((if b then True else i == finish) /\ inv h_2 (UInt32.v i) b))) let rec interruptible_for start finish inv f = if start = finish then (finish, false) else let start' = UInt32.(start +^ 1ul) in if f start then (start', true) else interruptible_for start' finish inv f (* To be extracted as: while (true) { bool b = <f> i; if (b) { break; } } *) val do_while: inv:(HS.mem -> bool -> GTot Type0) -> f:(unit -> Stack bool (requires (fun h -> inv h false)) (ensures (fun h_1 b h_2 -> inv h_1 false /\ inv h_2 b)) ) -> Stack unit (requires (fun h -> inv h false)) (ensures (fun _ _ h_2 -> inv h_2 true)) let rec do_while inv f = if not (f ()) then do_while inv f (* Extracted as: while (test ()) { body (); } *) val while: #test_pre: (HS.mem -> GTot Type0) -> #test_post: (bool -> HS.mem -> GTot Type0) -> $test: (unit -> Stack bool (requires (fun h -> test_pre h)) (ensures (fun h0 x h1 -> test_post x h1))) -> body: (unit -> Stack unit (requires (fun h -> test_post true h)) (ensures (fun h0 _ h1 -> test_pre h1))) -> Stack unit (requires (fun h -> test_pre h))
{ "checked_file": "/", "dependencies": [ "Spec.Loops.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "C.Loops.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "Buffer" }, { "abbrev": false, "full_module": "Spec.Loops", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "UInt64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "UInt32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
$test: (_: Prims.unit -> FStar.HyperStack.ST.Stack Prims.bool) -> body: (_: Prims.unit -> FStar.HyperStack.ST.Stack Prims.unit) -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "FStar.Monotonic.HyperStack.mem", "Prims.bool", "Prims.unit", "C.Loops.while" ]
[ "recursion" ]
false
true
false
false
false
let rec while #test_pre #test_post test body =
if test () then (body (); while #test_pre #test_post test body)
false
C.Loops.fst
C.Loops.for
val for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish)))
val for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish)))
let rec for start finish inv f = if start = finish then () else begin f start; for (UInt32.(start +^ 1ul)) finish inv f end
{ "file_name": "krmllib/C.Loops.fst", "git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321", "git_url": "https://github.com/FStarLang/karamel.git", "project_name": "karamel" }
{ "end_col": 5, "end_line": 60, "start_col": 0, "start_line": 54 }
(* This module exposes a series of combinators; they are modeled using * higher-order functions and specifications, and extracted, using a * meta-theoretic argument, to actual C loops. *) module C.Loops open FStar.HyperStack.ST open LowStar.Buffer open LowStar.BufferOps module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module UInt32 = FStar.UInt32 module UInt64 = FStar.UInt64 include Spec.Loops module Buffer = LowStar.Buffer #set-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20" (** The functions in this module use the following convention: * - the first arguments are buffers; * - the destination buffer comes first, followed by the input buffer (as in * C's memcpy) * - each buffer is followed by its length; if several buffers share the same * length, there is a single length argument after the buffers * - the function-specific arguments come next (e.g. the number of times one * may want to call the function in [repeat]) * - the second to last argument is the loop invariant (which may have * dependencies on all the parameters before) * - the last argument is the loop body (that will depend on the invariant, and * possibly all the other parameters before. *) (* Generic-purpose for-loop combinators ***************************************) (* These combinators enjoy first-class support in KaRaMeL. (See [combinators] in * src/Simplify.ml *) (* Currently extracting as: for (int i = <start>; i != <finish>; ++i) <f> i; *) val for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start)))
{ "checked_file": "/", "dependencies": [ "Spec.Loops.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "C.Loops.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "Buffer" }, { "abbrev": false, "full_module": "Spec.Loops", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "UInt64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "UInt32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
start: FStar.UInt32.t -> finish: FStar.UInt32.t{FStar.UInt32.v finish >= FStar.UInt32.v start} -> inv: (_: FStar.Monotonic.HyperStack.mem -> _: Prims.nat -> Type0) -> f: ( i: FStar.UInt32.t { FStar.UInt32.v start <= FStar.UInt32.v i /\ FStar.UInt32.v i < FStar.UInt32.v finish } -> FStar.HyperStack.ST.Stack Prims.unit) -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "FStar.UInt32.t", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.UInt32.v", "FStar.Monotonic.HyperStack.mem", "Prims.nat", "Prims.l_and", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Prims.unit", "Prims.op_Addition", "Prims.op_Equality", "Prims.bool", "C.Loops.for", "FStar.UInt32.op_Plus_Hat", "FStar.UInt32.__uint_to_t" ]
[ "recursion" ]
false
true
false
false
false
let rec for start finish inv f =
if start = finish then () else (f start; for (let open UInt32 in start +^ 1ul) finish inv f)
false
C.Loops.fst
C.Loops.do_while
val do_while: inv:(HS.mem -> bool -> GTot Type0) -> f:(unit -> Stack bool (requires (fun h -> inv h false)) (ensures (fun h_1 b h_2 -> inv h_1 false /\ inv h_2 b)) ) -> Stack unit (requires (fun h -> inv h false)) (ensures (fun _ _ h_2 -> inv h_2 true))
val do_while: inv:(HS.mem -> bool -> GTot Type0) -> f:(unit -> Stack bool (requires (fun h -> inv h false)) (ensures (fun h_1 b h_2 -> inv h_1 false /\ inv h_2 b)) ) -> Stack unit (requires (fun h -> inv h false)) (ensures (fun _ _ h_2 -> inv h_2 true))
let rec do_while inv f = if not (f ()) then do_while inv f
{ "file_name": "krmllib/C.Loops.fst", "git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321", "git_url": "https://github.com/FStarLang/karamel.git", "project_name": "karamel" }
{ "end_col": 18, "end_line": 148, "start_col": 0, "start_line": 146 }
(* This module exposes a series of combinators; they are modeled using * higher-order functions and specifications, and extracted, using a * meta-theoretic argument, to actual C loops. *) module C.Loops open FStar.HyperStack.ST open LowStar.Buffer open LowStar.BufferOps module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module UInt32 = FStar.UInt32 module UInt64 = FStar.UInt64 include Spec.Loops module Buffer = LowStar.Buffer #set-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20" (** The functions in this module use the following convention: * - the first arguments are buffers; * - the destination buffer comes first, followed by the input buffer (as in * C's memcpy) * - each buffer is followed by its length; if several buffers share the same * length, there is a single length argument after the buffers * - the function-specific arguments come next (e.g. the number of times one * may want to call the function in [repeat]) * - the second to last argument is the loop invariant (which may have * dependencies on all the parameters before) * - the last argument is the loop body (that will depend on the invariant, and * possibly all the other parameters before. *) (* Generic-purpose for-loop combinators ***************************************) (* These combinators enjoy first-class support in KaRaMeL. (See [combinators] in * src/Simplify.ml *) (* Currently extracting as: for (int i = <start>; i != <finish>; ++i) <f> i; *) val for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec for start finish inv f = if start = finish then () else begin f start; for (UInt32.(start +^ 1ul)) finish inv f end val for64: start:UInt64.t -> finish:UInt64.t{UInt64.v finish >= UInt64.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt64.t{UInt64.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt64.v i))) (ensures (fun h_1 _ h_2 -> UInt64.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt64.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt64.v finish))) let rec for64 start finish inv f = if start = finish then () else begin f start; for64 (UInt64.(start +^ 1UL)) finish inv f end (* To be extracted as: for (int i = <start>; i != <finish>; --i) <f> i; *) val reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i - 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec reverse_for start finish inv f = if start = finish then () else begin f start; reverse_for (UInt32.(start -^ 1ul)) finish inv f end (* To be extracted as: bool b = false; int i = <start>; for (; (!b) && (i != <end>); ++i) { b = <f> i; } (i, b) *) val interruptible_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> bool -> GTot Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack bool (requires (fun h -> inv h (UInt32.v i) false)) (ensures (fun h_1 b h_2 -> inv h_1 (UInt32.v i) false /\ inv h_2 UInt32.(v i + 1) b)) ) -> Stack (UInt32.t * bool) (requires (fun h -> inv h (UInt32.v start) false)) (ensures (fun _ res h_2 -> let (i, b) = res in ((if b then True else i == finish) /\ inv h_2 (UInt32.v i) b))) let rec interruptible_for start finish inv f = if start = finish then (finish, false) else let start' = UInt32.(start +^ 1ul) in if f start then (start', true) else interruptible_for start' finish inv f (* To be extracted as: while (true) { bool b = <f> i; if (b) { break; } } *) val do_while: inv:(HS.mem -> bool -> GTot Type0) -> f:(unit -> Stack bool (requires (fun h -> inv h false)) (ensures (fun h_1 b h_2 -> inv h_1 false /\ inv h_2 b)) ) -> Stack unit (requires (fun h -> inv h false))
{ "checked_file": "/", "dependencies": [ "Spec.Loops.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "C.Loops.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "Buffer" }, { "abbrev": false, "full_module": "Spec.Loops", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "UInt64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "UInt32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
inv: (_: FStar.Monotonic.HyperStack.mem -> _: Prims.bool -> Prims.GTot Type0) -> f: (_: Prims.unit -> FStar.HyperStack.ST.Stack Prims.bool) -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "FStar.Monotonic.HyperStack.mem", "Prims.bool", "Prims.unit", "Prims.l_and", "C.Loops.do_while", "Prims.op_Negation" ]
[ "recursion" ]
false
true
false
false
false
let rec do_while inv f =
if not (f ()) then do_while inv f
false
C.Loops.fst
C.Loops.interruptible_reverse_for
val interruptible_reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> bool -> GTot Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack bool (requires (fun h -> inv h (UInt32.v i) false)) (ensures (fun h_1 b h_2 -> inv h_1 (UInt32.v i) false /\ inv h_2 UInt32.(v i - 1) b)) ) -> Stack (UInt32.t * bool) (requires (fun h -> inv h (UInt32.v start) false)) (ensures (fun _ res h_2 -> let (i, b) = res in ((if b then True else i == finish) /\ inv h_2 (UInt32.v i) b)))
val interruptible_reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> bool -> GTot Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack bool (requires (fun h -> inv h (UInt32.v i) false)) (ensures (fun h_1 b h_2 -> inv h_1 (UInt32.v i) false /\ inv h_2 UInt32.(v i - 1) b)) ) -> Stack (UInt32.t * bool) (requires (fun h -> inv h (UInt32.v start) false)) (ensures (fun _ res h_2 -> let (i, b) = res in ((if b then True else i == finish) /\ inv h_2 (UInt32.v i) b)))
let rec interruptible_reverse_for start finish inv f = if start = finish then (finish, false) else let start' = UInt32.(start -^ 1ul) in if f start then (start', true) else interruptible_reverse_for start' finish inv f
{ "file_name": "krmllib/C.Loops.fst", "git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321", "git_url": "https://github.com/FStarLang/karamel.git", "project_name": "karamel" }
{ "end_col": 54, "end_line": 200, "start_col": 0, "start_line": 193 }
(* This module exposes a series of combinators; they are modeled using * higher-order functions and specifications, and extracted, using a * meta-theoretic argument, to actual C loops. *) module C.Loops open FStar.HyperStack.ST open LowStar.Buffer open LowStar.BufferOps module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module UInt32 = FStar.UInt32 module UInt64 = FStar.UInt64 include Spec.Loops module Buffer = LowStar.Buffer #set-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20" (** The functions in this module use the following convention: * - the first arguments are buffers; * - the destination buffer comes first, followed by the input buffer (as in * C's memcpy) * - each buffer is followed by its length; if several buffers share the same * length, there is a single length argument after the buffers * - the function-specific arguments come next (e.g. the number of times one * may want to call the function in [repeat]) * - the second to last argument is the loop invariant (which may have * dependencies on all the parameters before) * - the last argument is the loop body (that will depend on the invariant, and * possibly all the other parameters before. *) (* Generic-purpose for-loop combinators ***************************************) (* These combinators enjoy first-class support in KaRaMeL. (See [combinators] in * src/Simplify.ml *) (* Currently extracting as: for (int i = <start>; i != <finish>; ++i) <f> i; *) val for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec for start finish inv f = if start = finish then () else begin f start; for (UInt32.(start +^ 1ul)) finish inv f end val for64: start:UInt64.t -> finish:UInt64.t{UInt64.v finish >= UInt64.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt64.t{UInt64.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt64.v i))) (ensures (fun h_1 _ h_2 -> UInt64.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt64.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt64.v finish))) let rec for64 start finish inv f = if start = finish then () else begin f start; for64 (UInt64.(start +^ 1UL)) finish inv f end (* To be extracted as: for (int i = <start>; i != <finish>; --i) <f> i; *) val reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i - 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec reverse_for start finish inv f = if start = finish then () else begin f start; reverse_for (UInt32.(start -^ 1ul)) finish inv f end (* To be extracted as: bool b = false; int i = <start>; for (; (!b) && (i != <end>); ++i) { b = <f> i; } (i, b) *) val interruptible_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> bool -> GTot Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack bool (requires (fun h -> inv h (UInt32.v i) false)) (ensures (fun h_1 b h_2 -> inv h_1 (UInt32.v i) false /\ inv h_2 UInt32.(v i + 1) b)) ) -> Stack (UInt32.t * bool) (requires (fun h -> inv h (UInt32.v start) false)) (ensures (fun _ res h_2 -> let (i, b) = res in ((if b then True else i == finish) /\ inv h_2 (UInt32.v i) b))) let rec interruptible_for start finish inv f = if start = finish then (finish, false) else let start' = UInt32.(start +^ 1ul) in if f start then (start', true) else interruptible_for start' finish inv f (* To be extracted as: while (true) { bool b = <f> i; if (b) { break; } } *) val do_while: inv:(HS.mem -> bool -> GTot Type0) -> f:(unit -> Stack bool (requires (fun h -> inv h false)) (ensures (fun h_1 b h_2 -> inv h_1 false /\ inv h_2 b)) ) -> Stack unit (requires (fun h -> inv h false)) (ensures (fun _ _ h_2 -> inv h_2 true)) let rec do_while inv f = if not (f ()) then do_while inv f (* Extracted as: while (test ()) { body (); } *) val while: #test_pre: (HS.mem -> GTot Type0) -> #test_post: (bool -> HS.mem -> GTot Type0) -> $test: (unit -> Stack bool (requires (fun h -> test_pre h)) (ensures (fun h0 x h1 -> test_post x h1))) -> body: (unit -> Stack unit (requires (fun h -> test_post true h)) (ensures (fun h0 _ h1 -> test_pre h1))) -> Stack unit (requires (fun h -> test_pre h)) (ensures (fun h0 _ h1 -> test_post false h1)) let rec while #test_pre #test_post test body = if test () then begin body (); while #test_pre #test_post test body end (* To be extracted as: int i = <start>; bool b = false; for (; (!b) && (i != <end>); --i) { b = <f> i; } // i and b must be in scope after the loop *) val interruptible_reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> bool -> GTot Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack bool (requires (fun h -> inv h (UInt32.v i) false)) (ensures (fun h_1 b h_2 -> inv h_1 (UInt32.v i) false /\ inv h_2 UInt32.(v i - 1) b)) ) -> Stack (UInt32.t * bool) (requires (fun h -> inv h (UInt32.v start) false))
{ "checked_file": "/", "dependencies": [ "Spec.Loops.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "C.Loops.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "Buffer" }, { "abbrev": false, "full_module": "Spec.Loops", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "UInt64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "UInt32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
start: FStar.UInt32.t -> finish: FStar.UInt32.t{FStar.UInt32.v finish <= FStar.UInt32.v start} -> inv: (_: FStar.Monotonic.HyperStack.mem -> _: Prims.nat -> _: Prims.bool -> Prims.GTot Type0) -> f: ( i: FStar.UInt32.t { FStar.UInt32.v start >= FStar.UInt32.v i /\ FStar.UInt32.v i > FStar.UInt32.v finish } -> FStar.HyperStack.ST.Stack Prims.bool) -> FStar.HyperStack.ST.Stack (FStar.UInt32.t * Prims.bool)
FStar.HyperStack.ST.Stack
[]
[]
[ "FStar.UInt32.t", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "FStar.Monotonic.HyperStack.mem", "Prims.nat", "Prims.bool", "Prims.l_and", "Prims.op_GreaterThanOrEqual", "Prims.op_GreaterThan", "Prims.op_Subtraction", "Prims.op_Equality", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.tuple2", "C.Loops.interruptible_reverse_for", "FStar.UInt32.op_Subtraction_Hat", "FStar.UInt32.__uint_to_t" ]
[ "recursion" ]
false
true
false
false
false
let rec interruptible_reverse_for start finish inv f =
if start = finish then (finish, false) else let start' = let open UInt32 in start -^ 1ul in if f start then (start', true) else interruptible_reverse_for start' finish inv f
false
FStar.Tactics.BV.fst
FStar.Tactics.BV.trans_lt2
val trans_lt2: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (int2bv #n x == z) -> squash (int2bv #n y == w) -> squash (bvult #n z w) -> Lemma (x < y)
val trans_lt2: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (int2bv #n x == z) -> squash (int2bv #n y == w) -> squash (bvult #n z w) -> Lemma (x < y)
let trans_lt2 #n #x #y #z #w pf1 pf2 pf3 = int2bv_lemma_ult_2 x y
{ "file_name": "ulib/FStar.Tactics.BV.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 65, "end_line": 108, "start_col": 0, "start_line": 108 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.BV open FStar.Tactics.V2 open FStar.Reflection.V2.Formula open FStar.Reflection.V2.Arith open FStar.BV open FStar.UInt // using uint_t' instead of uint_t breaks the tactic (goes to inl). (* Congruence lemmas *) val cong_bvand : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvand #n w x == bvand #n y z) let cong_bvand #n #w #x #y #z pf1 pf2 = () val cong_bvxor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvxor w x == bvxor y z) let cong_bvxor #n #w #x #y #z pf1 pf2 = () val cong_bvor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvor w x == bvor y z) let cong_bvor #n #w #x #y #z pf1 pf2 = () val cong_bvshl : #n:pos -> (#w:bv_t n) -> (#x:uint_t n) -> (#y:bv_t n) -> squash (w == y) -> Lemma (bvshl w x == bvshl y x) let cong_bvshl #n #w #x #y pf = () val cong_bvshr : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvshr #n w x == bvshr #n y x) let cong_bvshr #n #w #x #y pf = () val cong_bvdiv : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvdiv #n w x == bvdiv #n y x) let cong_bvdiv #n #w #x #y pf = () val cong_bvmod : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmod #n w x == bvmod #n y x) let cong_bvmod #n #w #x #y pf = () val cong_bvmul : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmul #n w x == bvmul #n y x) let cong_bvmul #n #w #x #y pf = () val cong_bvadd : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvadd w x == bvadd y z) let cong_bvadd #n #w #x #y #z pf1 pf2 = () val cong_bvsub : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvsub w x == bvsub y z) let cong_bvsub #n #w #x #y #z pf1 pf2 = () (* Used to reduce the initial equation to an equation on bitvectors*) val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> squash (int2bv #n x == int2bv #n y) -> Lemma (x == y) let eq_to_bv #n #x #y pf = int2bv_lemma_2 #n x y val lt_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (b2t (bvult #n (int2bv #n x) (int2bv #n y))) -> Lemma (x < y) let lt_to_bv #n #x #y pf = int2bv_lemma_ult_2 #n x y (* Creates two fresh variables and two equations of the form int2bv x = z /\ int2bv y = w. The above lemmas transform these two equations before finally instantiating them through reflexivity, leaving Z3 to solve z = w *) val trans: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (x == z) -> squash (y == w) -> squash (z == w) -> Lemma (x == y) let trans #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> (eq2 #(bv_t n) x z) -> (eq2 #(bv_t n) y w) -> squash (bvult #n z w) -> Lemma (bvult #n x y) let trans_lt #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt2: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (int2bv #n x == z) -> squash (int2bv #n y == w) -> squash (bvult #n z w) ->
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.Arith.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.BV.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.BV.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "FStar.BV", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Arith", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Formula", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
pf1: Prims.squash (FStar.BV.int2bv x == z) -> pf2: Prims.squash (FStar.BV.int2bv y == w) -> pf3: Prims.squash (FStar.BV.bvult z w) -> FStar.Pervasives.Lemma (ensures x < y)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.pos", "FStar.UInt.uint_t", "FStar.BV.bv_t", "Prims.squash", "Prims.eq2", "FStar.BV.int2bv", "Prims.b2t", "FStar.BV.bvult", "FStar.BV.int2bv_lemma_ult_2", "Prims.unit" ]
[]
true
false
true
false
false
let trans_lt2 #n #x #y #z #w pf1 pf2 pf3 =
int2bv_lemma_ult_2 x y
false
Hacl.Hash.MD.fst
Hacl.Hash.MD.mod_sub_add
val mod_sub_add: a:int -> b:int -> c:int -> d:int -> p:pos -> Lemma (requires b % p = 0) (ensures (a - ((b + c) + d)) % p == (a - (c + d)) % p)
val mod_sub_add: a:int -> b:int -> c:int -> d:int -> p:pos -> Lemma (requires b % p = 0) (ensures (a - ((b + c) + d)) % p == (a - (c + d)) % p)
let mod_sub_add a b c d p = calc (==) { (a - ((b + c) + d)) % p; == { Math.Lemmas.lemma_mod_sub_distr a ((b + c) + d) p } (a - ((b + c) + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l (b + c) d p } (a - ((b + c) % p + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l b c p } (a - ((b % p + c) % p + d) % p) % p; == { } (a - (c % p + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l c d p } (a - (c + d) % p) % p; == { Math.Lemmas.lemma_mod_sub_distr a (c + d) p } (a - (c + d)) % p; }
{ "file_name": "code/hash/Hacl.Hash.MD.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 51, "start_col": 0, "start_line": 36 }
module Hacl.Hash.MD (** The Merkle-Damgård construction. *) module U8 = FStar.UInt8 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module U128 = FStar.UInt128 module Int = Lib.IntTypes module Lemmas = FStar.Math.Lemmas module B = LowStar.Buffer module S = FStar.Seq module HS = FStar.HyperStack module ST = FStar.HyperStack.ST open Hacl.Hash.Definitions open Hacl.Hash.Lemmas open Spec.Hash.Definitions open FStar.Mul module HI = Spec.Hash.Incremental module AH = Spec.Agile.Hash (** Auxiliary helpers *) #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let padding_round (a: md_alg) (len: len_t a): Lemma ((len_v a len + pad_length a (len_v a len)) % block_length a = 0) = () private val mod_sub_add: a:int -> b:int -> c:int -> d:int -> p:pos -> Lemma (requires b % p = 0)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.MD.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Incremental.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fst.checked", "Spec.Agile.Hash.fst.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.IntTypes.fsti.checked", "Hacl.Hash.PadFinish.fsti.checked", "Hacl.Hash.Lemmas.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt128.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.Int.Cast.Full.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Calc.fsti.checked", "C.Loops.fst.checked" ], "interface_file": true, "source_file": "Hacl.Hash.MD.fst" }
[ { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "AH" }, { "abbrev": true, "full_module": "Spec.Hash.Incremental", "short_module": "HI" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.Math.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.IntTypes", "short_module": "Int" }, { "abbrev": true, "full_module": "FStar.UInt128", "short_module": "U128" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Prims.int -> b: Prims.int -> c: Prims.int -> d: Prims.int -> p: Prims.pos -> FStar.Pervasives.Lemma (requires b % p = 0) (ensures (a - (b + c + d)) % p == (a - (c + d)) % p)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Prims.pos", "FStar.Calc.calc_finish", "Prims.eq2", "Prims.op_Modulus", "Prims.op_Subtraction", "Prims.op_Addition", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.lemma_mod_sub_distr", "Prims.squash", "FStar.Math.Lemmas.lemma_mod_plus_distr_l" ]
[]
false
false
true
false
false
let mod_sub_add a b c d p =
calc ( == ) { (a - ((b + c) + d)) % p; ( == ) { Math.Lemmas.lemma_mod_sub_distr a ((b + c) + d) p } (a - ((b + c) + d) % p) % p; ( == ) { Math.Lemmas.lemma_mod_plus_distr_l (b + c) d p } (a - ((b + c) % p + d) % p) % p; ( == ) { Math.Lemmas.lemma_mod_plus_distr_l b c p } (a - ((b % p + c) % p + d) % p) % p; ( == ) { () } (a - (c % p + d) % p) % p; ( == ) { Math.Lemmas.lemma_mod_plus_distr_l c d p } (a - (c + d) % p) % p; ( == ) { Math.Lemmas.lemma_mod_sub_distr a (c + d) p } (a - (c + d)) % p; }
false
FStar.Int64.fsti
FStar.Int64.n
val n : Prims.int
let n = 64
{ "file_name": "ulib/FStar.Int64.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 17, "end_line": 20, "start_col": 7, "start_line": 20 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int64 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int64.fsti" }
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.int
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let n =
64
false
C.Loops.fst
C.Loops.interruptible_for
val interruptible_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> bool -> GTot Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack bool (requires (fun h -> inv h (UInt32.v i) false)) (ensures (fun h_1 b h_2 -> inv h_1 (UInt32.v i) false /\ inv h_2 UInt32.(v i + 1) b)) ) -> Stack (UInt32.t * bool) (requires (fun h -> inv h (UInt32.v start) false)) (ensures (fun _ res h_2 -> let (i, b) = res in ((if b then True else i == finish) /\ inv h_2 (UInt32.v i) b)))
val interruptible_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> bool -> GTot Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack bool (requires (fun h -> inv h (UInt32.v i) false)) (ensures (fun h_1 b h_2 -> inv h_1 (UInt32.v i) false /\ inv h_2 UInt32.(v i + 1) b)) ) -> Stack (UInt32.t * bool) (requires (fun h -> inv h (UInt32.v start) false)) (ensures (fun _ res h_2 -> let (i, b) = res in ((if b then True else i == finish) /\ inv h_2 (UInt32.v i) b)))
let rec interruptible_for start finish inv f = if start = finish then (finish, false) else let start' = UInt32.(start +^ 1ul) in if f start then (start', true) else interruptible_for start' finish inv f
{ "file_name": "krmllib/C.Loops.fst", "git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321", "git_url": "https://github.com/FStarLang/karamel.git", "project_name": "karamel" }
{ "end_col": 46, "end_line": 128, "start_col": 0, "start_line": 121 }
(* This module exposes a series of combinators; they are modeled using * higher-order functions and specifications, and extracted, using a * meta-theoretic argument, to actual C loops. *) module C.Loops open FStar.HyperStack.ST open LowStar.Buffer open LowStar.BufferOps module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module UInt32 = FStar.UInt32 module UInt64 = FStar.UInt64 include Spec.Loops module Buffer = LowStar.Buffer #set-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20" (** The functions in this module use the following convention: * - the first arguments are buffers; * - the destination buffer comes first, followed by the input buffer (as in * C's memcpy) * - each buffer is followed by its length; if several buffers share the same * length, there is a single length argument after the buffers * - the function-specific arguments come next (e.g. the number of times one * may want to call the function in [repeat]) * - the second to last argument is the loop invariant (which may have * dependencies on all the parameters before) * - the last argument is the loop body (that will depend on the invariant, and * possibly all the other parameters before. *) (* Generic-purpose for-loop combinators ***************************************) (* These combinators enjoy first-class support in KaRaMeL. (See [combinators] in * src/Simplify.ml *) (* Currently extracting as: for (int i = <start>; i != <finish>; ++i) <f> i; *) val for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec for start finish inv f = if start = finish then () else begin f start; for (UInt32.(start +^ 1ul)) finish inv f end val for64: start:UInt64.t -> finish:UInt64.t{UInt64.v finish >= UInt64.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt64.t{UInt64.(v start <= v i /\ v i < v finish)} -> Stack unit (requires (fun h -> inv h (UInt64.v i))) (ensures (fun h_1 _ h_2 -> UInt64.(inv h_1 (v i) /\ inv h_2 (v i + 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt64.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt64.v finish))) let rec for64 start finish inv f = if start = finish then () else begin f start; for64 (UInt64.(start +^ 1UL)) finish inv f end (* To be extracted as: for (int i = <start>; i != <finish>; --i) <f> i; *) val reverse_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish <= UInt32.v start} -> inv:(HS.mem -> nat -> Type0) -> f:(i:UInt32.t{UInt32.(v start >= v i /\ v i > v finish)} -> Stack unit (requires (fun h -> inv h (UInt32.v i))) (ensures (fun h_1 _ h_2 -> UInt32.(inv h_1 (v i) /\ inv h_2 (v i - 1)))) ) -> Stack unit (requires (fun h -> inv h (UInt32.v start))) (ensures (fun _ _ h_2 -> inv h_2 (UInt32.v finish))) let rec reverse_for start finish inv f = if start = finish then () else begin f start; reverse_for (UInt32.(start -^ 1ul)) finish inv f end (* To be extracted as: bool b = false; int i = <start>; for (; (!b) && (i != <end>); ++i) { b = <f> i; } (i, b) *) val interruptible_for: start:UInt32.t -> finish:UInt32.t{UInt32.v finish >= UInt32.v start} -> inv:(HS.mem -> nat -> bool -> GTot Type0) -> f:(i:UInt32.t{UInt32.(v start <= v i /\ v i < v finish)} -> Stack bool (requires (fun h -> inv h (UInt32.v i) false)) (ensures (fun h_1 b h_2 -> inv h_1 (UInt32.v i) false /\ inv h_2 UInt32.(v i + 1) b)) ) -> Stack (UInt32.t * bool) (requires (fun h -> inv h (UInt32.v start) false))
{ "checked_file": "/", "dependencies": [ "Spec.Loops.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "C.Loops.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "Buffer" }, { "abbrev": false, "full_module": "Spec.Loops", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "UInt64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "UInt32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "C", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
start: FStar.UInt32.t -> finish: FStar.UInt32.t{FStar.UInt32.v finish >= FStar.UInt32.v start} -> inv: (_: FStar.Monotonic.HyperStack.mem -> _: Prims.nat -> _: Prims.bool -> Prims.GTot Type0) -> f: ( i: FStar.UInt32.t { FStar.UInt32.v start <= FStar.UInt32.v i /\ FStar.UInt32.v i < FStar.UInt32.v finish } -> FStar.HyperStack.ST.Stack Prims.bool) -> FStar.HyperStack.ST.Stack (FStar.UInt32.t * Prims.bool)
FStar.HyperStack.ST.Stack
[]
[]
[ "FStar.UInt32.t", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.UInt32.v", "FStar.Monotonic.HyperStack.mem", "Prims.nat", "Prims.bool", "Prims.l_and", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Prims.op_Addition", "Prims.op_Equality", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.tuple2", "C.Loops.interruptible_for", "FStar.UInt32.op_Plus_Hat", "FStar.UInt32.__uint_to_t" ]
[ "recursion" ]
false
true
false
false
false
let rec interruptible_for start finish inv f =
if start = finish then (finish, false) else let start' = let open UInt32 in start +^ 1ul in if f start then (start', true) else interruptible_for start' finish inv f
false
FStar.Int64.fsti
FStar.Int64.eq
val eq (a b: t) : Tot bool
val eq (a b: t) : Tot bool
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
{ "file_name": "ulib/FStar.Int64.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 114, "start_col": 0, "start_line": 114 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int64 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 64 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int64.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int64.t -> b: FStar.Int64.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int64.t", "FStar.Int.eq", "FStar.Int64.n", "FStar.Int64.v", "Prims.bool" ]
[]
false
false
false
true
false
let eq (a b: t) : Tot bool =
eq #n (v a) (v b)
false
Hacl.Hash.MD.fst
Hacl.Hash.MD.u32_to_len
val u32_to_len (a: hash_alg{is_md a}) (l: U32.t) : l': len_t a {len_v a l' = U32.v l}
val u32_to_len (a: hash_alg{is_md a}) (l: U32.t) : l': len_t a {len_v a l' = U32.v l}
let u32_to_len (a: hash_alg{is_md a}) (l: U32.t): l':len_t a { len_v a l' = U32.v l } = match a with | SHA2_384 | SHA2_512 -> FStar.Int.Cast.Full.(uint64_to_uint128 (uint32_to_uint64 l)) | _ -> FStar.Int.Cast.Full.uint32_to_uint64 l
{ "file_name": "code/hash/Hacl.Hash.MD.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 47, "end_line": 231, "start_col": 0, "start_line": 227 }
module Hacl.Hash.MD (** The Merkle-Damgård construction. *) module U8 = FStar.UInt8 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module U128 = FStar.UInt128 module Int = Lib.IntTypes module Lemmas = FStar.Math.Lemmas module B = LowStar.Buffer module S = FStar.Seq module HS = FStar.HyperStack module ST = FStar.HyperStack.ST open Hacl.Hash.Definitions open Hacl.Hash.Lemmas open Spec.Hash.Definitions open FStar.Mul module HI = Spec.Hash.Incremental module AH = Spec.Agile.Hash (** Auxiliary helpers *) #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" let padding_round (a: md_alg) (len: len_t a): Lemma ((len_v a len + pad_length a (len_v a len)) % block_length a = 0) = () private val mod_sub_add: a:int -> b:int -> c:int -> d:int -> p:pos -> Lemma (requires b % p = 0) (ensures (a - ((b + c) + d)) % p == (a - (c + d)) % p) let mod_sub_add a b c d p = calc (==) { (a - ((b + c) + d)) % p; == { Math.Lemmas.lemma_mod_sub_distr a ((b + c) + d) p } (a - ((b + c) + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l (b + c) d p } (a - ((b + c) % p + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l b c p } (a - ((b % p + c) % p + d) % p) % p; == { } (a - (c % p + d) % p) % p; == { Math.Lemmas.lemma_mod_plus_distr_l c d p } (a - (c + d) % p) % p; == { Math.Lemmas.lemma_mod_sub_distr a (c + d) p } (a - (c + d)) % p; } let pad0_length_mod (a: hash_alg{is_md a}) (base_len: nat) (len: nat): Lemma (requires base_len % block_length a = 0) (ensures pad0_length a (base_len + len) = pad0_length a len) = mod_sub_add (block_length a) base_len len (len_length a + 1) (block_length a) let pad_length_mod (a: hash_alg{is_md a}) (base_len len: nat): Lemma (requires base_len % block_length a = 0) (ensures pad_length a (base_len + len) = pad_length a len) = pad0_length_mod a base_len len val pad_len_bound : a : md_alg -> prev_len:len_t a { len_v a prev_len % block_length a = 0 } -> input_len:U32.t { (U32.v input_len + len_v a prev_len) `less_than_max_input_length` a} -> Lemma( (U32.v input_len % block_length a) + pad_length a (len_v a prev_len + U32.v input_len) <= 2 * block_length a) let pad_len_bound a prev_len input_len = () (* Avoiding an ill-formed pattern error... *) noextract inline_for_extraction let len_add32 a prev_len input_len = let open FStar.Int.Cast.Full in match a with | SHA2_224 | SHA2_256 | MD5 | SHA1 | Blake2S -> assert_norm (pow2 61 < pow2 64); U64.(prev_len +^ uint32_to_uint64 input_len) | SHA2_384 | SHA2_512 | Blake2B -> assert_norm (pow2 125 < pow2 128); U128.(prev_len +^ uint64_to_uint128 (uint32_to_uint64 input_len)) #push-options "--fuel 0 --ifuel 0 --z3rlimit 300" (** Iterated compression function. *) noextract inline_for_extraction let mk_update_multi a update s () blocks n_blocks = let h0 = ST.get () in let inv (h: HS.mem) (i: nat) = let i_block = i * block_length a in i <= U32.v n_blocks /\ B.live h s /\ B.live h blocks /\ B.(modifies (loc_buffer s) h0 h) /\ as_seq h s == Spec.Agile.Hash.update_multi a (as_seq h0 s) () (S.slice (B.as_seq h0 blocks) 0 i_block) in let f (i:U32.t { U32.(0 <= v i /\ v i < v n_blocks)}): ST.Stack unit (requires (fun h -> inv h (U32.v i))) (ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\ inv h1 (U32.v i + 1))) = let h1 = ST.get () in let sz = block_len a in let blocks0 = B.sub blocks 0ul U32.(sz *^ i) in let block = B.sub blocks U32.(sz *^ i) sz in update s block; (**) Spec.Hash.Lemmas.update_multi_update a (as_seq h1 s) (B.as_seq h0 block); (**) let h2 = ST.get () in (**) let blocks_v : Ghost.erased _ = B.as_seq h0 blocks in (**) let block_v : Ghost.erased _ = B.as_seq h0 block in (**) let blocks0_v : Ghost.erased _ = B.as_seq h0 blocks0 in assert ( let s1 = B.as_seq h1 s in let s2 = B.as_seq h2 s in let i = U32.v i in let n_blocks = U32.v n_blocks in block_length a * (i + 1) <= S.length blocks_v /\ (block_length a * (i + 1) - block_length a * i) % block_length a = 0 /\ S.equal block_v (S.slice blocks_v (block_length a * i) (block_length a * (i + 1))) /\ S.equal s2 (Spec.Agile.Hash.update_multi a s1 () block_v) ); (**) let i_block : Ghost.erased _ = block_length a * (U32.v i) in (**) Spec.Hash.Lemmas.update_multi_associative a (as_seq h0 s) (S.slice blocks_v 0 i_block) block_v in assert (B.length blocks = U32.v n_blocks * block_length a); Spec.Hash.Lemmas.update_multi_zero a (as_seq h0 s); C.Loops.for 0ul n_blocks inv f #pop-options #push-options "--fuel 0 --ifuel 0 --z3rlimit 400" (** An arbitrary number of bytes, then padding. *) noextract inline_for_extraction let mk_update_last a update_multi = assert_norm(block_length a > 0); fun pad s prev_len input input_len -> ST.push_frame (); let h0 = ST.get () in (* Get a series of complete blocks. *) let blocks_n = U32.(input_len /^ block_len a) in Math.Lemmas.nat_times_nat_is_nat (UInt32.v blocks_n) (block_length a); Math.Lemmas.euclidean_division_definition (U32.v input_len) (block_length a); let blocks_len = U32.(blocks_n *^ block_len a) in Math.Lemmas.cancel_mul_mod (U32.v blocks_n) (block_length a); assert (U32.v blocks_len % block_length a = 0); let blocks = B.sub input 0ul blocks_len in (* The rest that doesn't make up a complete block *) let rest_len = U32.(input_len -^ blocks_len) in assert (U32.v rest_len < block_length a); let rest = B.sub input blocks_len rest_len in assert(B.length blocks = U32.v blocks_len); assert(block_length a * U32.v blocks_n = U32.v blocks_n * block_length a); update_multi s () blocks blocks_n; let h1 = ST.get () in assert (S.equal (B.as_seq h0 input) (S.append (B.as_seq h1 blocks) (B.as_seq h1 rest))); assert (S.equal (as_seq h1 s) (Spec.Agile.Hash.update_multi a (B.as_seq h0 s) () (B.as_seq h0 blocks))); (* Compute the total number of bytes fed. *) let total_input_len: len_t a = len_add32 a prev_len input_len in (* Blit the remaining data and the padding together *) let pad_len = Hacl.Hash.PadFinish.pad_len a total_input_len in let tmp_len = U32.( rest_len +^ pad_len ) in assert (len_v a total_input_len = len_v a prev_len + U32.v blocks_len + U32.v rest_len); Lemmas.modulo_distributivity (len_v a prev_len) (U32.v blocks_len) (block_length a); Math.Lemmas.lemma_mod_plus_distr_r (len_v a prev_len) (U32.v blocks_len) (block_length a); assert ((len_v a prev_len + U32.v blocks_len) % block_length a = 0); pad_length_mod a (len_v a prev_len + U32.v blocks_len) (U32.v rest_len); padding_round a total_input_len; assert(FStar.UInt32.v tmp_len % Spec.Hash.Definitions.block_length a = 0); assert (U32.v tmp_len % block_length a = 0); pad_len_bound a prev_len input_len; assert (U32.v tmp_len <= 2 * block_length a); let tmp_twoblocks = B.alloca (Lib.IntTypes.u8 0) U32.(2ul *^ block_len a) in let tmp = B.sub tmp_twoblocks 0ul tmp_len in let tmp_rest = B.sub tmp 0ul rest_len in let tmp_pad = B.sub tmp rest_len pad_len in B.blit rest 0ul tmp_rest 0ul rest_len; pad total_input_len tmp_pad; let h2 = ST.get () in assert (S.equal (B.as_seq h2 tmp) (S.append (B.as_seq h2 tmp_rest) (B.as_seq h2 tmp_pad))); assert (S.equal (B.as_seq h2 tmp_rest) (B.as_seq h1 rest)); assert (S.equal (B.as_seq h2 tmp_pad) (Spec.Hash.MD.pad a (len_v a total_input_len))); (* Update multi those last few blocks *) Math.Lemmas.cancel_mul_mod (U32.v tmp_len) (block_length a); Math.Lemmas.euclidean_division_definition (U32.v tmp_len) (block_length a); Math.Lemmas.swap_mul (block_length a) (U32.v U32.(tmp_len /^ block_len a)); assert(B.length tmp = block_length a * U32.v U32.(tmp_len /^ block_len a)); update_multi s () tmp U32.(tmp_len /^ block_len a); let h3 = ST.get () in assert (S.equal (B.as_seq h3 s) (Spec.Agile.Hash.update_multi a (Spec.Agile.Hash.update_multi a (B.as_seq h0 s) () (B.as_seq h1 blocks)) () (S.append (B.as_seq h1 rest) (Spec.Hash.MD.pad a (len_v a total_input_len))))); assert ( let s1 = B.as_seq h1 blocks in let s2 = B.as_seq h2 rest in let s3 = Spec.Hash.MD.pad a (len_v a total_input_len) in S.equal (S.append s1 (S.append s2 s3)) (S.append (S.append s1 s2) s3)); Spec.Hash.Lemmas.update_multi_associative a (B.as_seq h0 s) (B.as_seq h1 blocks) (S.append (B.as_seq h1 rest) (Spec.Hash.MD.pad a (len_v a total_input_len))); ST.pop_frame () #pop-options #push-options "--ifuel 1"
{ "checked_file": "/", "dependencies": [ "Spec.Hash.MD.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Incremental.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fst.checked", "Spec.Agile.Hash.fst.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.IntTypes.fsti.checked", "Hacl.Hash.PadFinish.fsti.checked", "Hacl.Hash.Lemmas.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt128.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.Int.Cast.Full.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Calc.fsti.checked", "C.Loops.fst.checked" ], "interface_file": true, "source_file": "Hacl.Hash.MD.fst" }
[ { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "AH" }, { "abbrev": true, "full_module": "Spec.Hash.Incremental", "short_module": "HI" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.Math.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.IntTypes", "short_module": "Int" }, { "abbrev": true, "full_module": "FStar.UInt128", "short_module": "U128" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.hash_alg{Spec.Hash.Definitions.is_md a} -> l: FStar.UInt32.t -> l': Spec.Hash.Definitions.len_t a {Spec.Hash.Definitions.len_v a l' = FStar.UInt32.v l}
Prims.Tot
[ "total" ]
[]
[ "Spec.Hash.Definitions.hash_alg", "Prims.b2t", "Spec.Hash.Definitions.is_md", "FStar.UInt32.t", "FStar.Int.Cast.Full.uint64_to_uint128", "FStar.Int.Cast.uint32_to_uint64", "Spec.Hash.Definitions.len_t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "FStar.UInt.size", "FStar.UInt32.n", "Spec.Hash.Definitions.len_v", "FStar.UInt32.v" ]
[]
false
false
false
false
false
let u32_to_len (a: hash_alg{is_md a}) (l: U32.t) : l': len_t a {len_v a l' = U32.v l} =
match a with | SHA2_384 | SHA2_512 -> let open FStar.Int.Cast.Full in uint64_to_uint128 (uint32_to_uint64 l) | _ -> FStar.Int.Cast.Full.uint32_to_uint64 l
false
FStar.Tactics.BV.fst
FStar.Tactics.BV.arith_to_bv_tac
val arith_to_bv_tac: Prims.unit -> Tac unit
val arith_to_bv_tac: Prims.unit -> Tac unit
let arith_to_bv_tac () : Tac unit = focus (fun () -> norm [delta_only ["FStar.BV.bvult"]]; let g = cur_goal () in let f = term_as_formula g in match f with | Comp (Eq _) l r -> begin match run_tm (as_arith_expr l) with | Inl s -> dump s; trefl () | Inr e -> // dump "inr arith_to_bv"; seq (fun () -> arith_expr_to_bv e) trefl end | _ -> fail ("arith_to_bv_tac: unexpected: " ^ term_to_string g) )
{ "file_name": "ulib/FStar.Tactics.BV.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 1, "end_line": 176, "start_col": 0, "start_line": 160 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.BV open FStar.Tactics.V2 open FStar.Reflection.V2.Formula open FStar.Reflection.V2.Arith open FStar.BV open FStar.UInt // using uint_t' instead of uint_t breaks the tactic (goes to inl). (* Congruence lemmas *) val cong_bvand : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvand #n w x == bvand #n y z) let cong_bvand #n #w #x #y #z pf1 pf2 = () val cong_bvxor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvxor w x == bvxor y z) let cong_bvxor #n #w #x #y #z pf1 pf2 = () val cong_bvor : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvor w x == bvor y z) let cong_bvor #n #w #x #y #z pf1 pf2 = () val cong_bvshl : #n:pos -> (#w:bv_t n) -> (#x:uint_t n) -> (#y:bv_t n) -> squash (w == y) -> Lemma (bvshl w x == bvshl y x) let cong_bvshl #n #w #x #y pf = () val cong_bvshr : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvshr #n w x == bvshr #n y x) let cong_bvshr #n #w #x #y pf = () val cong_bvdiv : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvdiv #n w x == bvdiv #n y x) let cong_bvdiv #n #w #x #y pf = () val cong_bvmod : #n:pos -> #w:bv_t n -> (#x:uint_t n{x <> 0}) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmod #n w x == bvmod #n y x) let cong_bvmod #n #w #x #y pf = () val cong_bvmul : #n:pos -> #w:bv_t n -> (#x:uint_t n) -> #y:bv_t n -> squash (w == y) -> Lemma (bvmul #n w x == bvmul #n y x) let cong_bvmul #n #w #x #y pf = () val cong_bvadd : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvadd w x == bvadd y z) let cong_bvadd #n #w #x #y #z pf1 pf2 = () val cong_bvsub : #n:pos -> (#w:bv_t n) -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> squash (w == y) -> squash (x == z) -> Lemma (bvsub w x == bvsub y z) let cong_bvsub #n #w #x #y #z pf1 pf2 = () (* Used to reduce the initial equation to an equation on bitvectors*) val eq_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> squash (int2bv #n x == int2bv #n y) -> Lemma (x == y) let eq_to_bv #n #x #y pf = int2bv_lemma_2 #n x y val lt_to_bv: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (b2t (bvult #n (int2bv #n x) (int2bv #n y))) -> Lemma (x < y) let lt_to_bv #n #x #y pf = int2bv_lemma_ult_2 #n x y (* Creates two fresh variables and two equations of the form int2bv x = z /\ int2bv y = w. The above lemmas transform these two equations before finally instantiating them through reflexivity, leaving Z3 to solve z = w *) val trans: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (x == z) -> squash (y == w) -> squash (z == w) -> Lemma (x == y) let trans #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt: #n:pos -> (#x:bv_t n) -> (#y:bv_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> (eq2 #(bv_t n) x z) -> (eq2 #(bv_t n) y w) -> squash (bvult #n z w) -> Lemma (bvult #n x y) let trans_lt #n #x #y #z #w pf1 pf2 pf3 = () val trans_lt2: #n:pos -> (#x:uint_t n) -> (#y:uint_t n) -> (#z:bv_t n) -> (#w:bv_t n) -> squash (int2bv #n x == z) -> squash (int2bv #n y == w) -> squash (bvult #n z w) -> Lemma (x < y) let trans_lt2 #n #x #y #z #w pf1 pf2 pf3 = int2bv_lemma_ult_2 x y let rec arith_expr_to_bv (e:expr) : Tac unit = match e with | NatToBv (MulMod e1 _) | MulMod e1 _ -> apply_lemma (`int2bv_mul); apply_lemma (`cong_bvmul); arith_expr_to_bv e1 | NatToBv (Umod e1 _) | Umod e1 _ -> apply_lemma (`int2bv_mod); apply_lemma (`cong_bvmod); arith_expr_to_bv e1 | NatToBv (Udiv e1 _) | Udiv e1 _ -> apply_lemma (`int2bv_div); apply_lemma (`cong_bvdiv); arith_expr_to_bv e1 | NatToBv (Shl e1 _) | Shl e1 _ -> apply_lemma (`int2bv_shl); apply_lemma (`cong_bvshl); arith_expr_to_bv e1 | NatToBv (Shr e1 _) | Shr e1 _ -> apply_lemma (`int2bv_shr); apply_lemma (`cong_bvshr); arith_expr_to_bv e1 | NatToBv (Land e1 e2) | (Land e1 e2) -> apply_lemma (`int2bv_logand); apply_lemma (`cong_bvand); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lxor e1 e2) | (Lxor e1 e2) -> apply_lemma (`int2bv_logxor); apply_lemma (`cong_bvxor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lor e1 e2) | (Lor e1 e2) -> apply_lemma (`int2bv_logor); apply_lemma (`cong_bvor); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Ladd e1 e2) | (Ladd e1 e2) -> apply_lemma (`int2bv_add); apply_lemma (`cong_bvadd); arith_expr_to_bv e1; arith_expr_to_bv e2 | NatToBv (Lsub e1 e2) | (Lsub e1 e2) -> apply_lemma (`int2bv_sub); apply_lemma (`cong_bvsub); arith_expr_to_bv e1; arith_expr_to_bv e2 | _ -> trefl ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.Arith.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.BV.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.BV.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "FStar.BV", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Arith", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Formula", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.focus", "FStar.Pervasives.Native.option", "FStar.Stubs.Reflection.Types.typ", "FStar.Tactics.NamedView.term", "Prims.string", "FStar.Tactics.V2.Derived.trefl", "FStar.Stubs.Tactics.V2.Builtins.dump", "FStar.Reflection.V2.Arith.expr", "FStar.Tactics.V2.Derived.seq", "FStar.Tactics.BV.arith_expr_to_bv", "FStar.Pervasives.either", "FStar.Reflection.V2.Arith.run_tm", "FStar.Reflection.V2.Arith.as_arith_expr", "FStar.Reflection.V2.Formula.formula", "FStar.Tactics.V2.Derived.fail", "Prims.op_Hat", "FStar.Stubs.Tactics.V2.Builtins.term_to_string", "FStar.Reflection.V2.Formula.term_as_formula", "FStar.Tactics.V2.Derived.cur_goal", "FStar.Stubs.Tactics.V2.Builtins.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta_only", "Prims.Nil" ]
[]
false
true
false
false
false
let arith_to_bv_tac () : Tac unit =
focus (fun () -> norm [delta_only ["FStar.BV.bvult"]]; let g = cur_goal () in let f = term_as_formula g in match f with | Comp (Eq _) l r -> (match run_tm (as_arith_expr l) with | Inl s -> dump s; trefl () | Inr e -> seq (fun () -> arith_expr_to_bv e) trefl) | _ -> fail ("arith_to_bv_tac: unexpected: " ^ term_to_string g))
false
FStar.Int64.fsti
FStar.Int64.lt
val lt (a b: t) : Tot bool
val lt (a b: t) : Tot bool
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
{ "file_name": "ulib/FStar.Int64.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 117, "start_col": 0, "start_line": 117 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int64 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 64 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int64.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int64.t -> b: FStar.Int64.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int64.t", "FStar.Int.lt", "FStar.Int64.n", "FStar.Int64.v", "Prims.bool" ]
[]
false
false
false
true
false
let lt (a b: t) : Tot bool =
lt #n (v a) (v b)
false
FStar.Int64.fsti
FStar.Int64.gt
val gt (a b: t) : Tot bool
val gt (a b: t) : Tot bool
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
{ "file_name": "ulib/FStar.Int64.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 115, "start_col": 0, "start_line": 115 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int64 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 64 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int64.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int64.t -> b: FStar.Int64.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int64.t", "FStar.Int.gt", "FStar.Int64.n", "FStar.Int64.v", "Prims.bool" ]
[]
false
false
false
true
false
let gt (a b: t) : Tot bool =
gt #n (v a) (v b)
false
FStar.Int64.fsti
FStar.Int64.gte
val gte (a b: t) : Tot bool
val gte (a b: t) : Tot bool
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
{ "file_name": "ulib/FStar.Int64.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 51, "end_line": 116, "start_col": 0, "start_line": 116 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int64 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 64 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int64.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int64.t -> b: FStar.Int64.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int64.t", "FStar.Int.gte", "FStar.Int64.n", "FStar.Int64.v", "Prims.bool" ]
[]
false
false
false
true
false
let gte (a b: t) : Tot bool =
gte #n (v a) (v b)
false