effect
stringclasses 48
values | original_source_type
stringlengths 0
23k
| opens_and_abbrevs
listlengths 2
92
| isa_cross_project_example
bool 1
class | source_definition
stringlengths 9
57.9k
| partial_definition
stringlengths 7
23.3k
| is_div
bool 2
classes | is_type
null | is_proof
bool 2
classes | completed_definiton
stringlengths 1
250k
| dependencies
dict | effect_flags
sequencelengths 0
2
| ideal_premises
sequencelengths 0
236
| mutual_with
sequencelengths 0
11
| file_context
stringlengths 0
407k
| interleaved
bool 1
class | is_simply_typed
bool 2
classes | file_name
stringlengths 5
48
| vconfig
dict | is_simple_lemma
null | source_type
stringlengths 10
23k
| proof_features
sequencelengths 0
1
| name
stringlengths 8
95
| source
dict | verbose_type
stringlengths 1
7.42k
| source_range
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FStar.Tactics.Effect.Tac | val instantiate_as (fa x: term) (s: string) : Tac binder | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s | val instantiate_as (fa x: term) (s: string) : Tac binder
let instantiate_as (fa x: term) (s: string) : Tac binder = | true | null | false | let b = instantiate fa x in
rename_to b s | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"Prims.string",
"FStar.Tactics.V1.Builtins.rename_to",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.instantiate"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate" | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val instantiate_as (fa x: term) (s: string) : Tac binder | [] | FStar.Tactics.V1.Logic.instantiate_as | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | fa: FStar.Reflection.Types.term -> x: FStar.Reflection.Types.term -> s: Prims.string
-> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 17,
"end_line": 286,
"start_col": 69,
"start_line": 284
} |
FStar.Tactics.Effect.Tac | val sk_binder' (acc: binders) (b: binder) : Tac (binders * binder) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
) | val sk_binder' (acc: binders) (b: binder) : Tac (binders * binder)
let rec sk_binder' (acc: binders) (b: binder) : Tac (binders * binder) = | true | null | false | focus (fun () ->
try
(apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx :: acc) b')
with
| _ -> (acc, b)) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.binders",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Derived.focus",
"FStar.Pervasives.Native.tuple2",
"Prims.unit",
"FStar.Tactics.V1.Derived.try_with",
"FStar.Tactics.V1.Logic.sk_binder'",
"Prims.Cons",
"FStar.Tactics.V1.Logic.implies_intro",
"FStar.Tactics.V1.Logic.forall_intro",
"FStar.Tactics.V1.Builtins.clear",
"FStar.Tactics.V1.Derived.fail",
"Prims.bool",
"Prims.op_disEquality",
"Prims.int",
"FStar.Tactics.V1.Derived.ngoals",
"FStar.Tactics.V1.Derived.apply_lemma",
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.binder_to_term",
"Prims.exn",
"FStar.Pervasives.Native.Mktuple2"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sk_binder' (acc: binders) (b: binder) : Tac (binders * binder) | [
"recursion"
] | FStar.Tactics.V1.Logic.sk_binder' | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | acc: FStar.Reflection.Types.binders -> b: FStar.Reflection.Types.binder
-> FStar.Tactics.Effect.Tac (FStar.Reflection.Types.binders * FStar.Reflection.Types.binder) | {
"end_col": 3,
"end_line": 304,
"start_col": 2,
"start_line": 295
} |
FStar.Tactics.Effect.Tac | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let easy_fill () =
let _ = repeat intro in
(* If the goal is `a -> Lemma b`, intro will fail, try to use this switch *)
let _ = trytac (fun () -> apply (`lemma_from_squash); intro ()) in
smt () | let easy_fill () = | true | null | false | let _ = repeat intro in
let _ =
trytac (fun () ->
apply (`lemma_from_squash);
intro ())
in
smt () | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.smt",
"FStar.Pervasives.Native.option",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Derived.trytac",
"FStar.Tactics.V1.Builtins.intro",
"FStar.Tactics.V1.Derived.apply",
"Prims.list",
"FStar.Tactics.V1.Derived.repeat"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private
let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
)
(* Skolemizes a given binder for an existential, returning the introduced new binders
* and the skolemized formula. *)
let sk_binder b = sk_binder' [] b
let skolem () =
let bs = binders_of_env (cur_env ()) in
map sk_binder bs
private
val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x)
private
let lemma_from_squash #a #b f x = let _ = f x in assert (b x) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val easy_fill : _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | [] | FStar.Tactics.V1.Logic.easy_fill | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 10,
"end_line": 324,
"start_col": 18,
"start_line": 320
} |
|
Prims.Tot | val __elim_exists'
(#t: _)
(#pred: (t -> Type0))
(#goal: _)
(h: (exists x. pred x))
(k: (x: t -> pred x -> squash goal))
: squash goal | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf) | val __elim_exists'
(#t: _)
(#pred: (t -> Type0))
(#goal: _)
(h: (exists x. pred x))
(k: (x: t -> pred x -> squash goal))
: squash goal
let __elim_exists'
#t
(#pred: (t -> Type0))
#goal
(h: (exists x. pred x))
(k: (x: t -> pred x -> squash goal))
: squash goal = | false | null | true | FStar.Squash.bind_squash #(x: t & pred x) h (fun (| x , pf |) -> k x pf) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"total"
] | [
"Prims.l_Exists",
"Prims.squash",
"FStar.Squash.bind_squash",
"Prims.dtuple2"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x)) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val __elim_exists'
(#t: _)
(#pred: (t -> Type0))
(#goal: _)
(h: (exists x. pred x))
(k: (x: t -> pred x -> squash goal))
: squash goal | [] | FStar.Tactics.V1.Logic.__elim_exists' | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | h: (exists (x: t). pred x) -> k: (x: t -> _: pred x -> Prims.squash goal) -> Prims.squash goal | {
"end_col": 70,
"end_line": 261,
"start_col": 2,
"start_line": 261
} |
FStar.Tactics.Effect.Tac | val and_elim (t: term) : Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end | val and_elim (t: term) : Tac unit
let and_elim (t: term) : Tac unit = | true | null | false | try apply_lemma (`(__and_elim (`#t))) with | _ -> apply_lemma (`(__and_elim' (`#t))) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.try_with",
"Prims.unit",
"FStar.Tactics.V1.Derived.apply_lemma",
"Prims.exn"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit = | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val and_elim (t: term) : Tac unit | [] | FStar.Tactics.V1.Logic.and_elim | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | t: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 51,
"end_line": 244,
"start_col": 5,
"start_line": 243
} |
FStar.Tactics.Effect.Tac | val pose_lemma (t: term) : Tac binder | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b | val pose_lemma (t: term) : Tac binder
let pose_lemma (t: term) : Tac binder = | true | null | false | let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in
let post = norm_term [] post in
match term_as_formula' pre with
| True_ -> pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b =
pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t))))
in
flip ();
ignore (trytac trivial);
b | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.pose",
"FStar.Reflection.Types.binder",
"FStar.Reflection.V1.Formula.formula",
"Prims.unit",
"FStar.Pervasives.ignore",
"FStar.Pervasives.Native.option",
"FStar.Tactics.V1.Derived.trytac",
"FStar.Tactics.V1.Derived.trivial",
"FStar.Tactics.V1.Derived.flip",
"FStar.Tactics.V1.Derived.binder_to_term",
"FStar.Tactics.V1.Derived.tcut",
"FStar.Reflection.V1.Formula.term_as_formula'",
"FStar.Tactics.V1.Derived.norm_term",
"Prims.Nil",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.Native.tuple2",
"FStar.Reflection.V1.Builtins.inspect_comp",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V1.Data.comp_view",
"FStar.Tactics.V1.Derived.fail",
"FStar.Reflection.Types.comp",
"FStar.Tactics.V1.Builtins.tcc",
"FStar.Reflection.Types.env",
"FStar.Tactics.V1.Derived.cur_env"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h () | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pose_lemma (t: term) : Tac binder | [] | FStar.Tactics.V1.Logic.pose_lemma | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | t: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 5,
"end_line": 126,
"start_col": 40,
"start_line": 107
} |
FStar.Tactics.Effect.Tac | val implies_intro: Prims.unit -> Tac binder | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro () | val implies_intro: Prims.unit -> Tac binder
let implies_intro () : Tac binder = | true | null | false | apply_lemma (`imp_intro_lem);
intro () | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Builtins.intro",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Derived.apply_lemma"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val implies_intro: Prims.unit -> Tac binder | [] | FStar.Tactics.V1.Logic.implies_intro | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 12,
"end_line": 79,
"start_col": 4,
"start_line": 78
} |
FStar.Tactics.Effect.Tac | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let l_intro () = forall_intro `or_else` implies_intro | let l_intro () = | true | null | false | forall_intro `or_else` implies_intro | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.or_else",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.forall_intro",
"FStar.Tactics.V1.Logic.implies_intro"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val l_intro : _: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | [] | FStar.Tactics.V1.Logic.l_intro | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 53,
"end_line": 89,
"start_col": 17,
"start_line": 89
} |
|
FStar.Tactics.Effect.Tac | val cases_bool (b: term) : Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ()) | val cases_bool (b: term) : Tac unit
let cases_bool (b: term) : Tac unit = | true | null | false | let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () ->
let _ =
trytac (fun () ->
let b = implies_intro () in
rewrite b;
clear_top ())
in
()) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.seq",
"Prims.unit",
"FStar.Tactics.V1.Derived.apply_lemma",
"FStar.Reflection.V1.Derived.mk_e_app",
"Prims.Cons",
"Prims.Nil",
"FStar.Pervasives.Native.option",
"FStar.Tactics.V1.Derived.trytac",
"FStar.Tactics.V1.Builtins.clear_top",
"FStar.Tactics.V1.Builtins.rewrite",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.implies_intro"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = () | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val cases_bool (b: term) : Tac unit | [] | FStar.Tactics.V1.Logic.cases_bool | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 104,
"end_line": 215,
"start_col": 36,
"start_line": 212
} |
FStar.Tactics.Effect.Tac | val split: Prims.unit -> Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal" | val split: Prims.unit -> Tac unit
let split () : Tac unit = | true | null | false | try apply_lemma (`split_lem) with | _ -> fail "Could not split goal" | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.try_with",
"FStar.Tactics.V1.Derived.apply_lemma",
"Prims.exn",
"FStar.Tactics.V1.Derived.fail"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val split: Prims.unit -> Tac unit | [] | FStar.Tactics.V1.Logic.split | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 43,
"end_line": 68,
"start_col": 4,
"start_line": 67
} |
FStar.Tactics.Effect.Tac | val visit (callback: (unit -> Tac unit)) : Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
) | val visit (callback: (unit -> Tac unit)) : Tac unit
let rec visit (callback: (unit -> Tac unit)) : Tac unit = | true | null | false | focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q -> seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ -> ())) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.focus",
"FStar.Tactics.V1.Derived.or_else",
"FStar.Reflection.Types.bv",
"FStar.Reflection.Types.typ",
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.seq",
"FStar.Tactics.V1.Logic.visit",
"FStar.Tactics.V1.Logic.l_revert_all",
"FStar.Reflection.Types.binders",
"FStar.Tactics.V1.Logic.forall_intros",
"FStar.Tactics.V1.Logic.split",
"FStar.Tactics.V1.Logic.l_revert",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.implies_intro",
"FStar.Reflection.V1.Formula.formula",
"FStar.Reflection.V1.Formula.term_as_formula",
"FStar.Tactics.V1.Derived.cur_goal"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))])) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val visit (callback: (unit -> Tac unit)) : Tac unit | [
"recursion"
] | FStar.Tactics.V1.Logic.visit | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | callback: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit)
-> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 11,
"end_line": 150,
"start_col": 4,
"start_line": 134
} |
FStar.Tactics.Effect.Tac | val destruct_and (t: term) : Tac (binder * binder) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ()) | val destruct_and (t: term) : Tac (binder * binder)
let destruct_and (t: term) : Tac (binder * binder) = | true | null | false | and_elim t;
(implies_intro (), implies_intro ()) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.Types.binder",
"FStar.Pervasives.Native.tuple2",
"FStar.Tactics.V1.Logic.implies_intro",
"Prims.unit",
"FStar.Tactics.V1.Logic.and_elim"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val destruct_and (t: term) : Tac (binder * binder) | [] | FStar.Tactics.V1.Logic.destruct_and | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | t: FStar.Reflection.Types.term
-> FStar.Tactics.Effect.Tac (FStar.Reflection.Types.binder * FStar.Reflection.Types.binder) | {
"end_col": 40,
"end_line": 249,
"start_col": 4,
"start_line": 248
} |
FStar.Pervasives.Lemma | val lem3_fa
(#a #b #c #pre #post: _)
($lem: (x: a -> y: b -> z: c -> Lemma (requires pre x y z) (ensures post x y z)))
: Lemma (forall (x: a) (y: b) (z: c). pre x y z ==> post x y z) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lem3_fa #a #b #c #pre #post
($lem : (x:a -> y:b -> z:c -> Lemma (requires pre x y z) (ensures post x y z))) :
Lemma (forall (x:a) (y:b) (z:c). pre x y z ==> post x y z) =
let l' x y z : Lemma (pre x y z ==> post x y z) =
Classical.move_requires (lem x y) z
in
Classical.forall_intro_3 l' | val lem3_fa
(#a #b #c #pre #post: _)
($lem: (x: a -> y: b -> z: c -> Lemma (requires pre x y z) (ensures post x y z)))
: Lemma (forall (x: a) (y: b) (z: c). pre x y z ==> post x y z)
let lem3_fa
#a
#b
#c
#pre
#post
($lem: (x: a -> y: b -> z: c -> Lemma (requires pre x y z) (ensures post x y z)))
: Lemma (forall (x: a) (y: b) (z: c). pre x y z ==> post x y z) = | false | null | true | let l' x y z : Lemma (pre x y z ==> post x y z) = Classical.move_requires (lem x y) z in
Classical.forall_intro_3 l' | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"lemma"
] | [
"Prims.unit",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Classical.forall_intro_3",
"Prims.l_imp",
"Prims.l_True",
"FStar.Classical.move_requires",
"Prims.l_Forall"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private
let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
)
(* Skolemizes a given binder for an existential, returning the introduced new binders
* and the skolemized formula. *)
let sk_binder b = sk_binder' [] b
let skolem () =
let bs = binders_of_env (cur_env ()) in
map sk_binder bs
private
val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x)
private
let lemma_from_squash #a #b f x = let _ = f x in assert (b x)
private
let easy_fill () =
let _ = repeat intro in
(* If the goal is `a -> Lemma b`, intro will fail, try to use this switch *)
let _ = trytac (fun () -> apply (`lemma_from_squash); intro ()) in
smt ()
val easy : #a:Type -> (#[easy_fill ()] _ : a) -> a
let easy #a #x = x
private
let lem1_fa #a #pre #post
($lem : (x:a -> Lemma (requires pre x) (ensures post x))) :
Lemma (forall (x:a). pre x ==> post x) =
let l' x : Lemma (pre x ==> post x) =
Classical.move_requires lem x
in
Classical.forall_intro l'
private
let lem2_fa #a #b #pre #post
($lem : (x:a -> y:b -> Lemma (requires pre x y) (ensures post x y))) :
Lemma (forall (x:a) (y:b). pre x y ==> post x y) =
let l' x y : Lemma (pre x y ==> post x y) =
Classical.move_requires (lem x) y
in
Classical.forall_intro_2 l'
private
let lem3_fa #a #b #c #pre #post | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lem3_fa
(#a #b #c #pre #post: _)
($lem: (x: a -> y: b -> z: c -> Lemma (requires pre x y z) (ensures post x y z)))
: Lemma (forall (x: a) (y: b) (z: c). pre x y z ==> post x y z) | [] | FStar.Tactics.V1.Logic.lem3_fa | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | $lem: (x: a -> y: b -> z: c -> FStar.Pervasives.Lemma (requires pre x y z) (ensures post x y z))
-> FStar.Pervasives.Lemma (ensures forall (x: a) (y: b) (z: c). pre x y z ==> post x y z) | {
"end_col": 29,
"end_line": 354,
"start_col": 62,
"start_line": 350
} |
FStar.Tactics.Effect.Tac | val l_revert_all (bs: binders) : Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end | val l_revert_all (bs: binders) : Tac unit
let rec l_revert_all (bs: binders) : Tac unit = | true | null | false | match bs with
| [] -> ()
| _ :: tl ->
l_revert ();
l_revert_all tl | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.binders",
"Prims.unit",
"FStar.Reflection.Types.binder",
"Prims.list",
"FStar.Tactics.V1.Logic.l_revert_all",
"FStar.Tactics.V1.Logic.l_revert"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val l_revert_all (bs: binders) : Tac unit | [
"recursion"
] | FStar.Tactics.V1.Logic.l_revert_all | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | bs: FStar.Reflection.Types.binders -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 53,
"end_line": 42,
"start_col": 4,
"start_line": 40
} |
Prims.Tot | val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in () | val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = | false | null | true | let x:(_: unit{forall x. b x}) = s in
() | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"total"
] | [
"Prims.squash",
"Prims.l_Forall",
"Prims.unit"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) -> | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x) | [] | FStar.Tactics.V1.Logic.revert_squash | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s: Prims.squash (forall (x: a). b x) -> x: a -> Prims.squash (b x) | {
"end_col": 71,
"end_line": 31,
"start_col": 29,
"start_line": 31
} |
FStar.Pervasives.Lemma | val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f) | val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = | false | null | true | FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"lemma"
] | [
"Prims.squash",
"FStar.Classical.give_witness_from_squash",
"FStar.Squash.bind_squash",
"Prims.unit"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q | [] | FStar.Tactics.V1.Logic.vbind | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | sq: Prims.squash p -> f: (_: p -> Prims.squash q) -> FStar.Pervasives.Lemma (ensures q) | {
"end_col": 95,
"end_line": 187,
"start_col": 23,
"start_line": 187
} |
FStar.Pervasives.Lemma | val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f)) | val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f = | false | null | true | FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x: squash a) ->
FStar.Squash.bind_squash x f)) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"lemma"
] | [
"Prims.squash",
"FStar.Classical.give_witness",
"Prims.l_imp",
"FStar.Classical.arrow_to_impl",
"FStar.Squash.bind_squash",
"Prims.unit"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b) | [] | FStar.Tactics.V1.Logic.imp_intro_lem | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | f: (_: a -> Prims.squash b) -> FStar.Pervasives.Lemma (ensures a ==> b) | {
"end_col": 113,
"end_line": 74,
"start_col": 2,
"start_line": 74
} |
FStar.Pervasives.Lemma | val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lemma_from_squash #a #b f x = let _ = f x in assert (b x) | val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x)
let lemma_from_squash #a #b f x = | false | null | true | let _ = f x in
assert (b x) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"lemma"
] | [
"Prims.squash",
"Prims._assert",
"Prims.unit"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private
let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
)
(* Skolemizes a given binder for an existential, returning the introduced new binders
* and the skolemized formula. *)
let sk_binder b = sk_binder' [] b
let skolem () =
let bs = binders_of_env (cur_env ()) in
map sk_binder bs
private
val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x) | [] | FStar.Tactics.V1.Logic.lemma_from_squash | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | f: (x: a -> Prims.squash (b x)) -> x: a -> FStar.Pervasives.Lemma (ensures b x) | {
"end_col": 61,
"end_line": 317,
"start_col": 33,
"start_line": 317
} |
FStar.Tactics.Effect.Tac | val simplify_eq_implication: Prims.unit -> Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication | val simplify_eq_implication: Prims.unit -> Tac unit
let rec simplify_eq_implication () : Tac unit = | true | null | false | let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit simplify_eq_implication | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.fail",
"FStar.Reflection.V1.Formula.formula",
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Logic.visit",
"FStar.Tactics.V1.Logic.simplify_eq_implication",
"FStar.Tactics.V1.Builtins.clear_top",
"FStar.Tactics.V1.Builtins.rewrite",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.implies_intro",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"FStar.Tactics.V1.Derived.destruct_equality_implication",
"FStar.Reflection.Types.typ",
"FStar.Tactics.V1.Derived.cur_goal",
"FStar.Reflection.Types.env",
"FStar.Tactics.V1.Derived.cur_env"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val simplify_eq_implication: Prims.unit -> Tac unit | [
"recursion"
] | FStar.Tactics.V1.Logic.simplify_eq_implication | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 37,
"end_line": 163,
"start_col": 47,
"start_line": 152
} |
FStar.Tactics.Effect.Tac | val unfold_definition_and_simplify_eq (tm: term) : Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end | val unfold_definition_and_simplify_eq (tm: term) : Tac unit
let rec unfold_definition_and_simplify_eq (tm: term) : Tac unit = | true | null | false | let g = cur_goal () in
match term_as_formula g with
| App hd arg -> if term_eq hd tm then trivial ()
| _ ->
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Reflection.V1.Builtins.term_eq",
"FStar.Tactics.V1.Derived.trivial",
"Prims.unit",
"Prims.bool",
"FStar.Reflection.V1.Formula.formula",
"FStar.Tactics.V1.Derived.fail",
"FStar.Tactics.V1.Logic.visit",
"FStar.Tactics.V1.Logic.unfold_definition_and_simplify_eq",
"FStar.Tactics.V1.Builtins.clear_top",
"FStar.Tactics.V1.Builtins.rewrite",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.implies_intro",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"FStar.Tactics.V1.Derived.destruct_equality_implication",
"FStar.Reflection.V1.Formula.term_as_formula",
"FStar.Reflection.Types.typ",
"FStar.Tactics.V1.Derived.cur_goal"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val unfold_definition_and_simplify_eq (tm: term) : Tac unit | [
"recursion"
] | FStar.Tactics.V1.Logic.unfold_definition_and_simplify_eq | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | tm: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 11,
"end_line": 184,
"start_col": 64,
"start_line": 168
} |
Prims.Tot | val __lemma_to_squash:
#req: _ ->
#ens: _ ->
squash req ->
h: (unit -> Lemma (requires req) (ensures ens))
-> squash ens | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h () | val __lemma_to_squash:
#req: _ ->
#ens: _ ->
squash req ->
h: (unit -> Lemma (requires req) (ensures ens))
-> squash ens
let __lemma_to_squash #req #ens (_: squash req) (h: (unit -> Lemma (requires req) (ensures ens)))
: squash ens = | false | null | true | h () | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"total"
] | [
"Prims.squash",
"Prims.unit",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
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.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val __lemma_to_squash:
#req: _ ->
#ens: _ ->
squash req ->
h: (unit -> Lemma (requires req) (ensures ens))
-> squash ens | [] | FStar.Tactics.V1.Logic.__lemma_to_squash | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.squash req -> h: (_: Prims.unit -> FStar.Pervasives.Lemma (requires req) (ensures ens))
-> Prims.squash ens | {
"end_col": 6,
"end_line": 105,
"start_col": 2,
"start_line": 105
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let uint64 = UInt64.t | let uint64 = | false | null | false | UInt64.t | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"FStar.UInt64.t"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s | false | true | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint64 : Prims.eqtype | [] | Vale.Stdcalls.X64.GCM_IV.uint64 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.eqtype | {
"end_col": 21,
"end_line": 27,
"start_col": 13,
"start_line": 27
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tuint64 = TD_Base TUInt64 | let tuint64 = | false | null | false | TD_Base TUInt64 | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"Vale.Interop.Base.TD_Base",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret}) | false | true | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tuint64 : Vale.Interop.Base.td | [] | Vale.Stdcalls.X64.GCM_IV.tuint64 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.td | {
"end_col": 29,
"end_line": 42,
"start_col": 14,
"start_line": 42
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let b128 = buf_t TUInt8 TUInt128 | let b128 = | false | null | false | buf_t TUInt8 TUInt128 | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"Vale.Interop.Base.buf_t",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x | false | true | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val b128 : Type0 | [] | Vale.Stdcalls.X64.GCM_IV.b128 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 32,
"end_line": 36,
"start_col": 11,
"start_line": 36
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let code_compute_iv = GC.va_code_Compute_iv_stdcall IA.win | let code_compute_iv = | false | null | false | GC.va_code_Compute_iv_stdcall IA.win | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"Vale.AES.X64.GCMencryptOpt.va_code_Compute_iv_stdcall",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y
[@__reduce__] noextract
let compute_iv_pre : (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state) ->
GC.va_req_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
[@__reduce__] noextract
let compute_iv_post : (Ghost.erased supported_iv_LE) -> VSig.vale_post dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
va_s1 f
#set-options "--z3rlimit 50"
[@__reduce__] noextract
let compute_iv_lemma'
(iv:Ghost.erased supported_iv_LE)
(code:V.va_code)
(_win:bool)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b))
) = let va_s1, f = GC.va_lemma_Compute_iv_stdcall code va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_extra_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 j0_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 hkeys_b;
va_s1, f
(* Prove that compute1_iv_lemma' has the required type *)
noextract
let compute_iv_lemma (iv:Ghost.erased supported_iv_LE) = as_t
#(VSig.vale_sig_stdcall (compute_iv_pre iv) (compute_iv_post iv))
(compute_iv_lemma' iv) | false | true | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val code_compute_iv : Vale.X64.Decls.va_code | [] | Vale.Stdcalls.X64.GCM_IV.code_compute_iv | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.X64.Decls.va_code | {
"end_col": 58,
"end_line": 127,
"start_col": 22,
"start_line": 127
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq | let t128_mod = | false | null | false | TD_Buffer TUInt8 TUInt128 default_bq | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"Vale.Interop.Base.TD_Buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"Vale.Interop.Base.default_bq"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128 | false | true | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val t128_mod : Vale.Interop.Base.td | [] | Vale.Stdcalls.X64.GCM_IV.t128_mod | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.td | {
"end_col": 51,
"end_line": 38,
"start_col": 15,
"start_line": 38
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret}) | let t128_no_mod = | false | null | false | TD_Buffer TUInt8 TUInt128 ({ modified = false; strict_disjointness = false; taint = MS.Secret }) | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"Vale.Interop.Base.TD_Buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"Vale.Interop.Base.Mkbuffer_qualifiers",
"Vale.Arch.HeapTypes_s.Secret"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq | false | true | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val t128_no_mod : Vale.Interop.Base.td | [] | Vale.Stdcalls.X64.GCM_IV.t128_no_mod | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.td | {
"end_col": 106,
"end_line": 40,
"start_col": 18,
"start_line": 40
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let compute_iv_stdcall
= as_normal_t #((iv:Ghost.erased supported_iv_LE) -> lowstar_compute_iv_t iv)
(fun (iv:Ghost.erased supported_iv_LE) -> lowstar_compute_iv iv) | let compute_iv_stdcall = | false | null | false | as_normal_t #(iv: Ghost.erased supported_iv_LE -> lowstar_compute_iv_t iv)
(fun (iv: Ghost.erased supported_iv_LE) -> lowstar_compute_iv iv) | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"Vale.Stdcalls.X64.GCM_IV.as_normal_t",
"FStar.Ghost.erased",
"Vale.AES.GCM_s.supported_iv_LE",
"Vale.Stdcalls.X64.GCM_IV.lowstar_compute_iv_t",
"Vale.Stdcalls.X64.GCM_IV.lowstar_compute_iv"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y
[@__reduce__] noextract
let compute_iv_pre : (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state) ->
GC.va_req_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
[@__reduce__] noextract
let compute_iv_post : (Ghost.erased supported_iv_LE) -> VSig.vale_post dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
va_s1 f
#set-options "--z3rlimit 50"
[@__reduce__] noextract
let compute_iv_lemma'
(iv:Ghost.erased supported_iv_LE)
(code:V.va_code)
(_win:bool)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b))
) = let va_s1, f = GC.va_lemma_Compute_iv_stdcall code va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_extra_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 j0_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 hkeys_b;
va_s1, f
(* Prove that compute1_iv_lemma' has the required type *)
noextract
let compute_iv_lemma (iv:Ghost.erased supported_iv_LE) = as_t
#(VSig.vale_sig_stdcall (compute_iv_pre iv) (compute_iv_post iv))
(compute_iv_lemma' iv)
noextract
let code_compute_iv = GC.va_code_Compute_iv_stdcall IA.win
(* Here's the type expected for the compute_iv wrapper *)
[@__reduce__] noextract
let lowstar_compute_iv_t (iv:Ghost.erased supported_iv_LE) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_compute_iv
dom
[]
_
_
(W.mk_prediction code_compute_iv dom [] ((compute_iv_lemma iv) code_compute_iv IA.win))
(* And here's the gcm wrapper itself *)
noextract
let lowstar_compute_iv (iv:Ghost.erased supported_iv_LE) : lowstar_compute_iv_t iv =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.wrap_weak_stdcall
code_compute_iv
dom
(W.mk_prediction code_compute_iv dom [] ((compute_iv_lemma iv) code_compute_iv IA.win))
[@ (CCConv "stdcall") ] | false | false | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val compute_iv_stdcall : Vale.Interop.Base.normal (iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE
-> Vale.Stdcalls.X64.GCM_IV.lowstar_compute_iv_t iv) | [] | Vale.Stdcalls.X64.GCM_IV.compute_iv_stdcall | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.normal (iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE
-> Vale.Stdcalls.X64.GCM_IV.lowstar_compute_iv_t iv) | {
"end_col": 70,
"end_line": 154,
"start_col": 4,
"start_line": 153
} |
|
Prims.Tot | val as_t (#a: Type) (x: normal a) : a | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let as_t (#a:Type) (x:normal a) : a = x | val as_t (#a: Type) (x: normal a) : a
let as_t (#a: Type) (x: normal a) : a = | false | null | false | x | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"Vale.Interop.Base.normal"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *) | false | false | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val as_t (#a: Type) (x: normal a) : a | [] | Vale.Stdcalls.X64.GCM_IV.as_t | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Interop.Base.normal a -> a | {
"end_col": 39,
"end_line": 31,
"start_col": 38,
"start_line": 31
} |
Prims.Tot | val as_normal_t (#a: Type) (x: a) : normal a | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let as_normal_t (#a:Type) (x:a) : normal a = x | val as_normal_t (#a: Type) (x: a) : normal a
let as_normal_t (#a: Type) (x: a) : normal a = | false | null | false | x | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"Vale.Interop.Base.normal"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x | false | false | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val as_normal_t (#a: Type) (x: a) : normal a | [] | Vale.Stdcalls.X64.GCM_IV.as_normal_t | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: a -> Vale.Interop.Base.normal a | {
"end_col": 46,
"end_line": 33,
"start_col": 45,
"start_line": 33
} |
Prims.Tot | val dom:dom: list td {List.length dom <= 20} | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y | val dom:dom: list td {List.length dom <= 20}
let dom:dom: list td {List.length dom <= 20} = | false | null | false | let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list",
"Prims.Cons",
"Vale.Stdcalls.X64.GCM_IV.t128_no_mod",
"Vale.Stdcalls.X64.GCM_IV.tuint64",
"Vale.Stdcalls.X64.GCM_IV.t128_mod",
"Prims.Nil"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64 | false | false | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val dom:dom: list td {List.length dom <= 20} | [] | Vale.Stdcalls.X64.GCM_IV.dom | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | dom: Prims.list Vale.Interop.Base.td {FStar.List.Tot.Base.length dom <= 20} | {
"end_col": 3,
"end_line": 48,
"start_col": 43,
"start_line": 45
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_compute_iv_t (iv:Ghost.erased supported_iv_LE) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_compute_iv
dom
[]
_
_
(W.mk_prediction code_compute_iv dom [] ((compute_iv_lemma iv) code_compute_iv IA.win)) | let lowstar_compute_iv_t (iv: Ghost.erased supported_iv_LE) = | false | null | false | assert_norm (List.length dom + List.length ([] <: list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall code_compute_iv
dom
[]
_
_
(W.mk_prediction code_compute_iv dom [] ((compute_iv_lemma iv) code_compute_iv IA.win)) | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"FStar.Ghost.erased",
"Vale.AES.GCM_s.supported_iv_LE",
"Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall",
"Vale.Stdcalls.X64.GCM_IV.code_compute_iv",
"Vale.Stdcalls.X64.GCM_IV.dom",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_lemma",
"Vale.Interop.Assumptions.win",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y
[@__reduce__] noextract
let compute_iv_pre : (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state) ->
GC.va_req_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
[@__reduce__] noextract
let compute_iv_post : (Ghost.erased supported_iv_LE) -> VSig.vale_post dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
va_s1 f
#set-options "--z3rlimit 50"
[@__reduce__] noextract
let compute_iv_lemma'
(iv:Ghost.erased supported_iv_LE)
(code:V.va_code)
(_win:bool)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b))
) = let va_s1, f = GC.va_lemma_Compute_iv_stdcall code va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_extra_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 j0_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 hkeys_b;
va_s1, f
(* Prove that compute1_iv_lemma' has the required type *)
noextract
let compute_iv_lemma (iv:Ghost.erased supported_iv_LE) = as_t
#(VSig.vale_sig_stdcall (compute_iv_pre iv) (compute_iv_post iv))
(compute_iv_lemma' iv)
noextract
let code_compute_iv = GC.va_code_Compute_iv_stdcall IA.win
(* Here's the type expected for the compute_iv wrapper *)
[@__reduce__] noextract | false | true | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_compute_iv_t : iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE -> Type0 | [] | Vale.Stdcalls.X64.GCM_IV.lowstar_compute_iv_t | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE -> Type0 | {
"end_col": 91,
"end_line": 140,
"start_col": 2,
"start_line": 133
} |
|
Prims.Tot | val lowstar_compute_iv (iv: Ghost.erased supported_iv_LE) : lowstar_compute_iv_t iv | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_compute_iv (iv:Ghost.erased supported_iv_LE) : lowstar_compute_iv_t iv =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.wrap_weak_stdcall
code_compute_iv
dom
(W.mk_prediction code_compute_iv dom [] ((compute_iv_lemma iv) code_compute_iv IA.win)) | val lowstar_compute_iv (iv: Ghost.erased supported_iv_LE) : lowstar_compute_iv_t iv
let lowstar_compute_iv (iv: Ghost.erased supported_iv_LE) : lowstar_compute_iv_t iv = | false | null | false | assert_norm (List.length dom + List.length ([] <: list arg) <= 20);
IX64.wrap_weak_stdcall code_compute_iv
dom
(W.mk_prediction code_compute_iv dom [] ((compute_iv_lemma iv) code_compute_iv IA.win)) | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"FStar.Ghost.erased",
"Vale.AES.GCM_s.supported_iv_LE",
"Vale.Interop.X64.wrap_weak_stdcall",
"Vale.Stdcalls.X64.GCM_IV.code_compute_iv",
"Vale.Stdcalls.X64.GCM_IV.dom",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_lemma",
"Vale.Interop.Assumptions.win",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list",
"Vale.Stdcalls.X64.GCM_IV.lowstar_compute_iv_t"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y
[@__reduce__] noextract
let compute_iv_pre : (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state) ->
GC.va_req_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
[@__reduce__] noextract
let compute_iv_post : (Ghost.erased supported_iv_LE) -> VSig.vale_post dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
va_s1 f
#set-options "--z3rlimit 50"
[@__reduce__] noextract
let compute_iv_lemma'
(iv:Ghost.erased supported_iv_LE)
(code:V.va_code)
(_win:bool)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b))
) = let va_s1, f = GC.va_lemma_Compute_iv_stdcall code va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_extra_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 j0_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 hkeys_b;
va_s1, f
(* Prove that compute1_iv_lemma' has the required type *)
noextract
let compute_iv_lemma (iv:Ghost.erased supported_iv_LE) = as_t
#(VSig.vale_sig_stdcall (compute_iv_pre iv) (compute_iv_post iv))
(compute_iv_lemma' iv)
noextract
let code_compute_iv = GC.va_code_Compute_iv_stdcall IA.win
(* Here's the type expected for the compute_iv wrapper *)
[@__reduce__] noextract
let lowstar_compute_iv_t (iv:Ghost.erased supported_iv_LE) =
assert_norm (List.length dom + List.length ([]<:list arg) <= 20);
IX64.as_lowstar_sig_t_weak_stdcall
code_compute_iv
dom
[]
_
_
(W.mk_prediction code_compute_iv dom [] ((compute_iv_lemma iv) code_compute_iv IA.win))
(* And here's the gcm wrapper itself *)
noextract | false | false | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_compute_iv (iv: Ghost.erased supported_iv_LE) : lowstar_compute_iv_t iv | [] | Vale.Stdcalls.X64.GCM_IV.lowstar_compute_iv | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE
-> Vale.Stdcalls.X64.GCM_IV.lowstar_compute_iv_t iv | {
"end_col": 91,
"end_line": 149,
"start_col": 2,
"start_line": 145
} |
Prims.Tot | val compute_iv_pre: (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let compute_iv_pre : (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state) ->
GC.va_req_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b) | val compute_iv_pre: (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom
let compute_iv_pre: (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom = | false | null | false | fun
(iv: Ghost.erased supported_iv_LE)
(c: V.va_code)
(iv_b: b128)
(num_bytes: uint64)
(len: uint64)
(j0_b: b128)
(iv_extra_b: b128)
(hkeys_b: b128)
(va_s0: V.va_state)
->
GC.va_req_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv) (as_vale_buffer iv_b)
(UInt64.v num_bytes) (UInt64.v len) (as_vale_buffer j0_b) (as_vale_buffer iv_extra_b)
(as_vale_buffer hkeys_b) | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"FStar.Ghost.erased",
"Vale.AES.GCM_s.supported_iv_LE",
"Vale.X64.Decls.va_code",
"Vale.Stdcalls.X64.GCM_IV.b128",
"Vale.Stdcalls.X64.GCM_IV.uint64",
"Vale.X64.Decls.va_state",
"Vale.AES.X64.GCMencryptOpt.va_req_Compute_iv_stdcall",
"Vale.Interop.Assumptions.win",
"FStar.Ghost.reveal",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"FStar.UInt64.v",
"Prims.prop"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y
[@__reduce__] noextract | false | true | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val compute_iv_pre: (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom | [] | Vale.Stdcalls.X64.GCM_IV.compute_iv_pre | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE
-> Vale.AsLowStar.ValeSig.vale_pre Vale.Stdcalls.X64.GCM_IV.dom | {
"end_col": 60,
"end_line": 65,
"start_col": 2,
"start_line": 53
} |
Prims.Tot | val compute_iv_post: (Ghost.erased supported_iv_LE) -> VSig.vale_post dom | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let compute_iv_post : (Ghost.erased supported_iv_LE) -> VSig.vale_post dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
va_s1 f | val compute_iv_post: (Ghost.erased supported_iv_LE) -> VSig.vale_post dom
let compute_iv_post: (Ghost.erased supported_iv_LE) -> VSig.vale_post dom = | false | null | false | fun
(iv: Ghost.erased supported_iv_LE)
(c: V.va_code)
(iv_b: b128)
(num_bytes: uint64)
(len: uint64)
(j0_b: b128)
(iv_extra_b: b128)
(hkeys_b: b128)
(va_s0: V.va_state)
(va_s1: V.va_state)
(f: V.va_fuel)
->
GC.va_ens_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv) (as_vale_buffer iv_b)
(UInt64.v num_bytes) (UInt64.v len) (as_vale_buffer j0_b) (as_vale_buffer iv_extra_b)
(as_vale_buffer hkeys_b) va_s1 f | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"FStar.Ghost.erased",
"Vale.AES.GCM_s.supported_iv_LE",
"Vale.X64.Decls.va_code",
"Vale.Stdcalls.X64.GCM_IV.b128",
"Vale.Stdcalls.X64.GCM_IV.uint64",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"Vale.AES.X64.GCMencryptOpt.va_ens_Compute_iv_stdcall",
"Vale.Interop.Assumptions.win",
"FStar.Ghost.reveal",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"FStar.UInt64.v",
"Prims.prop"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y
[@__reduce__] noextract
let compute_iv_pre : (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state) ->
GC.va_req_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
[@__reduce__] noextract | false | true | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val compute_iv_post: (Ghost.erased supported_iv_LE) -> VSig.vale_post dom | [] | Vale.Stdcalls.X64.GCM_IV.compute_iv_post | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE
-> Vale.AsLowStar.ValeSig.vale_post Vale.Stdcalls.X64.GCM_IV.dom | {
"end_col": 15,
"end_line": 84,
"start_col": 2,
"start_line": 69
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let compute_iv_lemma (iv:Ghost.erased supported_iv_LE) = as_t
#(VSig.vale_sig_stdcall (compute_iv_pre iv) (compute_iv_post iv))
(compute_iv_lemma' iv) | let compute_iv_lemma (iv: Ghost.erased supported_iv_LE) = | false | null | false | as_t #(VSig.vale_sig_stdcall (compute_iv_pre iv) (compute_iv_post iv)) (compute_iv_lemma' iv) | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [
"total"
] | [
"FStar.Ghost.erased",
"Vale.AES.GCM_s.supported_iv_LE",
"Vale.Stdcalls.X64.GCM_IV.as_t",
"Vale.AsLowStar.ValeSig.vale_sig_stdcall",
"Vale.Stdcalls.X64.GCM_IV.dom",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_pre",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_post",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_lemma'"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y
[@__reduce__] noextract
let compute_iv_pre : (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state) ->
GC.va_req_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
[@__reduce__] noextract
let compute_iv_post : (Ghost.erased supported_iv_LE) -> VSig.vale_post dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
va_s1 f
#set-options "--z3rlimit 50"
[@__reduce__] noextract
let compute_iv_lemma'
(iv:Ghost.erased supported_iv_LE)
(code:V.va_code)
(_win:bool)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b))
) = let va_s1, f = GC.va_lemma_Compute_iv_stdcall code va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_extra_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 j0_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 hkeys_b;
va_s1, f
(* Prove that compute1_iv_lemma' has the required type *) | false | false | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val compute_iv_lemma : iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE
-> Vale.AsLowStar.ValeSig.vale_sig_stdcall (Vale.Stdcalls.X64.GCM_IV.compute_iv_pre iv)
(Vale.Stdcalls.X64.GCM_IV.compute_iv_post iv) | [] | Vale.Stdcalls.X64.GCM_IV.compute_iv_lemma | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE
-> Vale.AsLowStar.ValeSig.vale_sig_stdcall (Vale.Stdcalls.X64.GCM_IV.compute_iv_pre iv)
(Vale.Stdcalls.X64.GCM_IV.compute_iv_post iv) | {
"end_col": 25,
"end_line": 124,
"start_col": 57,
"start_line": 122
} |
|
Prims.Ghost | val compute_iv_lemma'
(iv: Ghost.erased supported_iv_LE)
(code: V.va_code)
(_win: bool)
(iv_b: b128)
(num_bytes len: uint64)
(j0_b iv_extra_b hkeys_b: b128)
(va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b))) | [
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": "GC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let compute_iv_lemma'
(iv:Ghost.erased supported_iv_LE)
(code:V.va_code)
(_win:bool)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b))
) = let va_s1, f = GC.va_lemma_Compute_iv_stdcall code va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_extra_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 j0_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 hkeys_b;
va_s1, f | val compute_iv_lemma'
(iv: Ghost.erased supported_iv_LE)
(code: V.va_code)
(_win: bool)
(iv_b: b128)
(num_bytes len: uint64)
(j0_b iv_extra_b hkeys_b: b128)
(va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b)))
let compute_iv_lemma'
(iv: Ghost.erased supported_iv_LE)
(code: V.va_code)
(_win: bool)
(iv_b: b128)
(num_bytes len: uint64)
(j0_b iv_extra_b hkeys_b: b128)
(va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b))) = | false | null | false | let va_s1, f =
GC.va_lemma_Compute_iv_stdcall code va_s0 IA.win (Ghost.reveal iv) (as_vale_buffer iv_b)
(UInt64.v num_bytes) (UInt64.v len) (as_vale_buffer j0_b) (as_vale_buffer iv_extra_b)
(as_vale_buffer hkeys_b)
in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 iv_extra_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 j0_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 hkeys_b;
va_s1, f | {
"checked_file": "Vale.Stdcalls.X64.GCM_IV.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.GCM_IV.fst"
} | [] | [
"FStar.Ghost.erased",
"Vale.AES.GCM_s.supported_iv_LE",
"Vale.X64.Decls.va_code",
"Prims.bool",
"Vale.Stdcalls.X64.GCM_IV.b128",
"Vale.Stdcalls.X64.GCM_IV.uint64",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple2",
"Prims.unit",
"Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.AES.X64.GCMencryptOpt.va_lemma_Compute_iv_stdcall",
"Vale.Interop.Assumptions.win",
"FStar.Ghost.reveal",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"FStar.UInt64.v",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_pre",
"Prims.l_and",
"Vale.X64.Decls.eval_code",
"Vale.AsLowStar.ValeSig.vale_calling_conventions_stdcall",
"Vale.Stdcalls.X64.GCM_IV.compute_iv_post",
"Vale.X64.Memory.buffer_writeable"
] | [] | module Vale.Stdcalls.X64.GCM_IV
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module GC = Vale.AES.X64.GCMencryptOpt
open Vale.AES.GCM_s
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let tuint64 = TD_Base TUInt64
[@__reduce__] noextract
let (dom: list td{List.length dom <= 20}) =
let y = [t128_no_mod; tuint64; tuint64; t128_mod; t128_no_mod; t128_no_mod] in
assert_norm (List.length y = 6);
y
[@__reduce__] noextract
let compute_iv_pre : (Ghost.erased supported_iv_LE) -> VSig.vale_pre dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state) ->
GC.va_req_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
[@__reduce__] noextract
let compute_iv_post : (Ghost.erased supported_iv_LE) -> VSig.vale_post dom =
fun (iv:Ghost.erased supported_iv_LE)
(c:V.va_code)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
GC.va_ens_Compute_iv_stdcall c va_s0 IA.win (Ghost.reveal iv)
(as_vale_buffer iv_b) (UInt64.v num_bytes)
(UInt64.v len) (as_vale_buffer j0_b)
(as_vale_buffer iv_extra_b) (as_vale_buffer hkeys_b)
va_s1 f
#set-options "--z3rlimit 50"
[@__reduce__] noextract
let compute_iv_lemma'
(iv:Ghost.erased supported_iv_LE)
(code:V.va_code)
(_win:bool)
(iv_b:b128)
(num_bytes:uint64)
(len:uint64)
(j0_b:b128)
(iv_extra_b:b128)
(hkeys_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\ | false | false | Vale.Stdcalls.X64.GCM_IV.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val compute_iv_lemma'
(iv: Ghost.erased supported_iv_LE)
(code: V.va_code)
(_win: bool)
(iv_b: b128)
(num_bytes len: uint64)
(j0_b iv_extra_b hkeys_b: b128)
(va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires compute_iv_pre iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
compute_iv_post iv code iv_b num_bytes len j0_b iv_extra_b hkeys_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer iv_b) /\
ME.buffer_writeable (as_vale_buffer hkeys_b) /\
ME.buffer_writeable (as_vale_buffer iv_extra_b) /\
ME.buffer_writeable (as_vale_buffer j0_b))) | [] | Vale.Stdcalls.X64.GCM_IV.compute_iv_lemma' | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.GCM_IV.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
iv: FStar.Ghost.erased Vale.AES.GCM_s.supported_iv_LE ->
code: Vale.X64.Decls.va_code ->
_win: Prims.bool ->
iv_b: Vale.Stdcalls.X64.GCM_IV.b128 ->
num_bytes: Vale.Stdcalls.X64.GCM_IV.uint64 ->
len: Vale.Stdcalls.X64.GCM_IV.uint64 ->
j0_b: Vale.Stdcalls.X64.GCM_IV.b128 ->
iv_extra_b: Vale.Stdcalls.X64.GCM_IV.b128 ->
hkeys_b: Vale.Stdcalls.X64.GCM_IV.b128 ->
va_s0: Vale.X64.Decls.va_state
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 13,
"end_line": 118,
"start_col": 6,
"start_line": 110
} |
Prims.Tot | val gcd_inv (n0 l0: SZ.t) (pn pl: R.ref SZ.t) (b: bool) : Tot vprop | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b | val gcd_inv (n0 l0: SZ.t) (pn pl: R.ref SZ.t) (b: bool) : Tot vprop
let gcd_inv (n0 l0: SZ.t) (pn pl: R.ref SZ.t) (b: bool) : Tot vprop = | false | null | false | gcd_inv0 n0 l0 pn pl b | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [
"total"
] | [
"FStar.SizeT.t",
"Steel.ST.Reference.ref",
"Prims.bool",
"Steel.ST.GenArraySwap.gcd_inv0",
"Steel.Effect.Common.vprop"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool) | false | true | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gcd_inv (n0 l0: SZ.t) (pn pl: R.ref SZ.t) (b: bool) : Tot vprop | [] | Steel.ST.GenArraySwap.gcd_inv | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
n0: FStar.SizeT.t ->
l0: FStar.SizeT.t ->
pn: Steel.ST.Reference.ref FStar.SizeT.t ->
pl: Steel.ST.Reference.ref FStar.SizeT.t ->
b: Prims.bool
-> Steel.Effect.Common.vprop | {
"end_col": 24,
"end_line": 40,
"start_col": 2,
"start_line": 40
} |
Prims.Tot | val gcd_inv0 (n0 l0: SZ.t) (pn pl: R.ref SZ.t) (b: bool) : Tot vprop | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
)) | val gcd_inv0 (n0 l0: SZ.t) (pn pl: R.ref SZ.t) (b: bool) : Tot vprop
let gcd_inv0 (n0 l0: SZ.t) (pn pl: R.ref SZ.t) (b: bool) : Tot vprop = | false | null | false | exists_ (fun n ->
exists_ (fun l ->
((R.pts_to pn full_perm n) `star` (R.pts_to pl full_perm l))
`star`
(pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)))) | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [
"total"
] | [
"FStar.SizeT.t",
"Steel.ST.Reference.ref",
"Prims.bool",
"Steel.ST.Util.exists_",
"Steel.Effect.Common.star",
"Steel.ST.Reference.pts_to",
"Steel.FractionalPermission.full_perm",
"Steel.ST.Util.pure",
"Steel.ST.GenArraySwap.gcd_inv_prop",
"FStar.SizeT.v",
"Steel.Effect.Common.vprop"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool) | false | true | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gcd_inv0 (n0 l0: SZ.t) (pn pl: R.ref SZ.t) (b: bool) : Tot vprop | [] | Steel.ST.GenArraySwap.gcd_inv0 | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
n0: FStar.SizeT.t ->
l0: FStar.SizeT.t ->
pn: Steel.ST.Reference.ref FStar.SizeT.t ->
pl: Steel.ST.Reference.ref FStar.SizeT.t ->
b: Prims.bool
-> Steel.Effect.Common.vprop | {
"end_col": 4,
"end_line": 31,
"start_col": 2,
"start_line": 27
} |
Prims.Tot | val array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
=
R.pts_to pi full_perm i `star`
pts_to s | val array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop = | false | null | false | (R.pts_to pi full_perm i) `star` (pts_to s) | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [
"total"
] | [
"Steel.ST.GenArraySwap.array_pts_to_t",
"Steel.ST.Reference.ref",
"FStar.SizeT.t",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Steel.Effect.Common.star",
"Steel.ST.Reference.pts_to",
"Steel.FractionalPermission.full_perm",
"Steel.Effect.Common.vprop"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d
#push-options "--z3rlimit 16"
#restart-solver
let gcd
(n0: SZ.t)
(l0: SZ.t)
: ST SZ.t
emp
(fun _ -> emp)
(SZ.v l0 < SZ.v n0)
(fun res -> gcd_post n0 l0 res)
= let res =
R.with_local n0 (fun pn ->
R.with_local l0 (fun pl ->
noop ();
rewrite (gcd_inv0 n0 l0 pn pl (l0 `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l0 `SZ.gt` 0sz));
Steel.ST.Loops.while_loop
(gcd_inv n0 l0 pn pl)
(fun _ ->
let gb = elim_exists () in
rewrite (gcd_inv n0 l0 pn pl gb) (gcd_inv0 n0 l0 pn pl gb);
let _ = gen_elim () in
let l = R.read pl in
[@@inline_let]
let b = l `SZ.gt` 0sz in
noop ();
rewrite (gcd_inv0 n0 l0 pn pl b) (gcd_inv n0 l0 pn pl b);
return b
)
(fun _ ->
rewrite (gcd_inv n0 l0 pn pl true) (gcd_inv0 n0 l0 pn pl true);
let _ = gen_elim () in
let n = R.read pn in
let l = R.read pl in
[@@inline_let]
let l' = SZ.rem n l in
R.write pn l;
R.write pl l';
rewrite (gcd_inv0 n0 l0 pn pl (l' `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l' `SZ.gt` 0sz));
noop ()
);
rewrite (gcd_inv n0 l0 pn pl false) (gcd_inv0 n0 l0 pn pl false);
let _ = gen_elim () in
let res = R.read pn in
return res
)
)
in
elim_pure (gcd_post n0 l0 res);
return res
#pop-options
let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
= n == Seq.length s0 /\
n == Seq.length s /\
0 < l /\
l < n /\
i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' < i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)
))) /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' > i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx
)))
let array_swap_inner_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(j: nat)
(idx: nat)
(b: bool)
: GTot prop
= Prf.array_swap_inner_invariant s0 n l bz s i j idx /\
(b == (j < bz.q_n - 1))
let array_swap_outer_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(b: bool)
: GTot prop
= Prf.array_swap_outer_invariant s0 n l bz s i /\
(b == (i < bz.d))
[@@__reduce__]
let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop | false | false | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop | [] | Steel.ST.GenArraySwap.array_swap_outer_invariant_body0 | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
pts_to: Steel.ST.GenArraySwap.array_pts_to_t t ->
pi: Steel.ST.Reference.ref FStar.SizeT.t ->
i: FStar.SizeT.t ->
s: FStar.Ghost.erased (FStar.Seq.Base.seq t)
-> Steel.Effect.Common.vprop | {
"end_col": 12,
"end_line": 168,
"start_col": 4,
"start_line": 167
} |
Prims.Tot | val array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
(j idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
= R.pts_to pi full_perm i `star`
R.pts_to pj full_perm j `star`
R.pts_to pidx full_perm idx `star`
pts_to s | val array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
(j idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
let array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
(j idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop = | false | null | false | (((R.pts_to pi full_perm i) `star` (R.pts_to pj full_perm j)) `star` (R.pts_to pidx full_perm idx))
`star`
(pts_to s) | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [
"total"
] | [
"Steel.ST.GenArraySwap.array_pts_to_t",
"FStar.SizeT.t",
"Steel.ST.GenArraySwap.Proof.bezout",
"FStar.SizeT.v",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Steel.ST.Reference.ref",
"Prims.bool",
"Steel.Effect.Common.star",
"Steel.ST.Reference.pts_to",
"Steel.FractionalPermission.full_perm",
"Steel.Effect.Common.vprop"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d
#push-options "--z3rlimit 16"
#restart-solver
let gcd
(n0: SZ.t)
(l0: SZ.t)
: ST SZ.t
emp
(fun _ -> emp)
(SZ.v l0 < SZ.v n0)
(fun res -> gcd_post n0 l0 res)
= let res =
R.with_local n0 (fun pn ->
R.with_local l0 (fun pl ->
noop ();
rewrite (gcd_inv0 n0 l0 pn pl (l0 `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l0 `SZ.gt` 0sz));
Steel.ST.Loops.while_loop
(gcd_inv n0 l0 pn pl)
(fun _ ->
let gb = elim_exists () in
rewrite (gcd_inv n0 l0 pn pl gb) (gcd_inv0 n0 l0 pn pl gb);
let _ = gen_elim () in
let l = R.read pl in
[@@inline_let]
let b = l `SZ.gt` 0sz in
noop ();
rewrite (gcd_inv0 n0 l0 pn pl b) (gcd_inv n0 l0 pn pl b);
return b
)
(fun _ ->
rewrite (gcd_inv n0 l0 pn pl true) (gcd_inv0 n0 l0 pn pl true);
let _ = gen_elim () in
let n = R.read pn in
let l = R.read pl in
[@@inline_let]
let l' = SZ.rem n l in
R.write pn l;
R.write pl l';
rewrite (gcd_inv0 n0 l0 pn pl (l' `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l' `SZ.gt` 0sz));
noop ()
);
rewrite (gcd_inv n0 l0 pn pl false) (gcd_inv0 n0 l0 pn pl false);
let _ = gen_elim () in
let res = R.read pn in
return res
)
)
in
elim_pure (gcd_post n0 l0 res);
return res
#pop-options
let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
= n == Seq.length s0 /\
n == Seq.length s /\
0 < l /\
l < n /\
i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' < i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)
))) /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' > i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx
)))
let array_swap_inner_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(j: nat)
(idx: nat)
(b: bool)
: GTot prop
= Prf.array_swap_inner_invariant s0 n l bz s i j idx /\
(b == (j < bz.q_n - 1))
let array_swap_outer_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(b: bool)
: GTot prop
= Prf.array_swap_outer_invariant s0 n l bz s i /\
(b == (i < bz.d))
[@@__reduce__]
let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
=
R.pts_to pi full_perm i `star`
pts_to s
[@@erasable]
noeq
type array_swap_outer_invariant_t (t: Type)
= {
i: SZ.t;
s: Ghost.erased (Seq.seq t);
}
[@@__reduce__]
let array_swap_outer_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_outer_invariant_body0 pts_to pi w.i w.s `star`
pure (array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b)
)
let array_swap_outer_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_outer_invariant0 pts_to n l bz s0 pi b
let intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True)
= let w = {
i = i;
s = s;
}
in
rewrite (array_swap_outer_invariant_body0 pts_to pi i s) (array_swap_outer_invariant_body0 pts_to pi w.i w.s);
rewrite (array_swap_outer_invariant0 pts_to n l bz s0 pi b) (array_swap_outer_invariant pts_to n l bz s0 pi b)
let elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t) opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w ->
array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\
True // (b == false ==> Ghost.reveal w.s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l)))
)
= let w = elim_exists () in
let _ = gen_elim () in
// Classical.move_requires (array_swap_outer_invariant_prop_end (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i)) b;
noop ();
w
[@@erasable]
noeq
type array_swap_inner_invariant_t (t: Type)
= {
j: SZ.t;
idx: SZ.t;
s: Ghost.erased (Seq.seq t)
}
[@@__reduce__]
let array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t)) | false | false | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
(j idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop | [] | Steel.ST.GenArraySwap.array_swap_inner_invariant_body0 | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
pts_to: Steel.ST.GenArraySwap.array_pts_to_t t ->
n: FStar.SizeT.t ->
l: FStar.SizeT.t ->
bz: Steel.ST.GenArraySwap.Proof.bezout (FStar.SizeT.v n) (FStar.SizeT.v l) ->
s0: FStar.Ghost.erased (FStar.Seq.Base.seq t) ->
pi: Steel.ST.Reference.ref FStar.SizeT.t ->
i: FStar.SizeT.t ->
pj: Steel.ST.Reference.ref FStar.SizeT.t ->
pidx: Steel.ST.Reference.ref FStar.SizeT.t ->
b: Prims.bool ->
j: FStar.SizeT.t ->
idx: FStar.SizeT.t ->
s: FStar.Ghost.erased (FStar.Seq.Base.seq t)
-> Steel.Effect.Common.vprop | {
"end_col": 12,
"end_line": 284,
"start_col": 4,
"start_line": 281
} |
Prims.Tot | val gcd_inv_prop (n0 l0 n l: nat) (b: bool) : Tot prop | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0) | val gcd_inv_prop (n0 l0 n l: nat) (b: bool) : Tot prop
let gcd_inv_prop (n0 l0 n l: nat) (b: bool) : Tot prop = | false | null | false | l0 < n0 /\ l < n /\ (Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\ b == (l > 0) | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.bool",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.pos",
"Steel.ST.GenArraySwap.Proof.__proj__Mkbezout_t__item__d",
"Steel.ST.GenArraySwap.Proof.mk_bezout",
"Prims.op_GreaterThan",
"Prims.prop"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool) | false | true | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gcd_inv_prop (n0 l0 n l: nat) (b: bool) : Tot prop | [] | Steel.ST.GenArraySwap.gcd_inv_prop | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | n0: Prims.nat -> l0: Prims.nat -> n: Prims.nat -> l: Prims.nat -> b: Prims.bool -> Prims.prop | {
"end_col": 14,
"end_line": 17,
"start_col": 2,
"start_line": 14
} |
Prims.Tot | val gcd_post (n0 l0 res: SZ.t) : Tot prop | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d | val gcd_post (n0 l0 res: SZ.t) : Tot prop
let gcd_post (n0 l0 res: SZ.t) : Tot prop = | false | null | false | SZ.v l0 < SZ.v n0 /\ SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [
"total"
] | [
"FStar.SizeT.t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.SizeT.v",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"Prims.op_GreaterThan",
"Steel.ST.GenArraySwap.Proof.__proj__Mkbezout_t__item__d",
"Steel.ST.GenArraySwap.Proof.mk_bezout",
"Prims.prop"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t) | false | true | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gcd_post (n0 l0 res: SZ.t) : Tot prop | [] | Steel.ST.GenArraySwap.gcd_post | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | n0: FStar.SizeT.t -> l0: FStar.SizeT.t -> res: FStar.SizeT.t -> Prims.prop | {
"end_col": 51,
"end_line": 48,
"start_col": 2,
"start_line": 47
} |
Prims.GTot | val array_swap_partial_invariant
(#t: Type)
(n l: nat)
(bz: Prf.bezout n l)
(s0 s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
= n == Seq.length s0 /\
n == Seq.length s /\
0 < l /\
l < n /\
i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' < i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)
))) /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' > i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx
))) | val array_swap_partial_invariant
(#t: Type)
(n l: nat)
(bz: Prf.bezout n l)
(s0 s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
let array_swap_partial_invariant
(#t: Type)
(n l: nat)
(bz: Prf.bezout n l)
(s0 s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop = | false | null | false | n == Seq.length s0 /\ n == Seq.length s /\ 0 < l /\ l < n /\ i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d).
(forall (j: Prf.nat_up_to bz.q_n).
(i' < i) ==>
(let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)))) /\
(forall (i': Prf.nat_up_to bz.d).
(forall (j: Prf.nat_up_to bz.q_n).
(i' > i) ==>
(let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx))) | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [
"sometrivial"
] | [
"Prims.nat",
"Steel.ST.GenArraySwap.Proof.bezout",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Prims.l_and",
"Prims.eq2",
"FStar.Seq.Base.length",
"FStar.Ghost.reveal",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"Steel.ST.GenArraySwap.Proof.__proj__Mkbezout_t__item__d",
"Prims.l_Forall",
"Steel.ST.GenArraySwap.Proof.nat_up_to",
"Steel.ST.GenArraySwap.Proof.__proj__Mkbezout_t__item__q_n",
"Prims.l_imp",
"FStar.Seq.Base.index",
"Steel.ST.GenArraySwap.Proof.jump",
"Steel.ST.GenArraySwap.Proof.iter_fun",
"Prims.op_GreaterThan",
"Prims.prop"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d
#push-options "--z3rlimit 16"
#restart-solver
let gcd
(n0: SZ.t)
(l0: SZ.t)
: ST SZ.t
emp
(fun _ -> emp)
(SZ.v l0 < SZ.v n0)
(fun res -> gcd_post n0 l0 res)
= let res =
R.with_local n0 (fun pn ->
R.with_local l0 (fun pl ->
noop ();
rewrite (gcd_inv0 n0 l0 pn pl (l0 `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l0 `SZ.gt` 0sz));
Steel.ST.Loops.while_loop
(gcd_inv n0 l0 pn pl)
(fun _ ->
let gb = elim_exists () in
rewrite (gcd_inv n0 l0 pn pl gb) (gcd_inv0 n0 l0 pn pl gb);
let _ = gen_elim () in
let l = R.read pl in
[@@inline_let]
let b = l `SZ.gt` 0sz in
noop ();
rewrite (gcd_inv0 n0 l0 pn pl b) (gcd_inv n0 l0 pn pl b);
return b
)
(fun _ ->
rewrite (gcd_inv n0 l0 pn pl true) (gcd_inv0 n0 l0 pn pl true);
let _ = gen_elim () in
let n = R.read pn in
let l = R.read pl in
[@@inline_let]
let l' = SZ.rem n l in
R.write pn l;
R.write pl l';
rewrite (gcd_inv0 n0 l0 pn pl (l' `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l' `SZ.gt` 0sz));
noop ()
);
rewrite (gcd_inv n0 l0 pn pl false) (gcd_inv0 n0 l0 pn pl false);
let _ = gen_elim () in
let res = R.read pn in
return res
)
)
in
elim_pure (gcd_post n0 l0 res);
return res
#pop-options
let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat) | false | false | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val array_swap_partial_invariant
(#t: Type)
(n l: nat)
(bz: Prf.bezout n l)
(s0 s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop | [] | Steel.ST.GenArraySwap.array_swap_partial_invariant | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
n: Prims.nat ->
l: Prims.nat ->
bz: Steel.ST.GenArraySwap.Proof.bezout n l ->
s0: FStar.Ghost.erased (FStar.Seq.Base.seq t) ->
s: FStar.Ghost.erased (FStar.Seq.Base.seq t) ->
i: Prims.nat
-> Prims.GTot Prims.prop | {
"end_col": 5,
"end_line": 128,
"start_col": 2,
"start_line": 112
} |
Prims.Pure | val impl_jump (n l idx: SZ.t)
: Pure SZ.t
(requires (SZ.v l < SZ.v n /\ SZ.v idx < SZ.v n))
(ensures (fun idx' -> SZ.v idx' == Prf.jump (SZ.v n) (SZ.v l) (SZ.v idx))) | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let impl_jump
(n: SZ.t)
(l: SZ.t)
(idx: SZ.t)
: Pure SZ.t
(requires (
SZ.v l < SZ.v n /\
SZ.v idx < SZ.v n
))
(ensures (fun idx' ->
SZ.v idx' == Prf.jump (SZ.v n) (SZ.v l) (SZ.v idx)
))
= Prf.jump_if (SZ.v n) (SZ.v l) () (SZ.v idx);
[@@inline_let]
let nl = n `SZ.sub` l in
if idx `SZ.gte` nl
then idx `SZ.sub` nl
else idx `SZ.add` l | val impl_jump (n l idx: SZ.t)
: Pure SZ.t
(requires (SZ.v l < SZ.v n /\ SZ.v idx < SZ.v n))
(ensures (fun idx' -> SZ.v idx' == Prf.jump (SZ.v n) (SZ.v l) (SZ.v idx)))
let impl_jump (n l idx: SZ.t)
: Pure SZ.t
(requires (SZ.v l < SZ.v n /\ SZ.v idx < SZ.v n))
(ensures (fun idx' -> SZ.v idx' == Prf.jump (SZ.v n) (SZ.v l) (SZ.v idx))) = | false | null | false | Prf.jump_if (SZ.v n) (SZ.v l) () (SZ.v idx);
[@@ inline_let ]let nl = n `SZ.sub` l in
if idx `SZ.gte` nl then idx `SZ.sub` nl else idx `SZ.add` l | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [] | [
"FStar.SizeT.t",
"FStar.SizeT.gte",
"FStar.SizeT.sub",
"Prims.bool",
"FStar.SizeT.add",
"Prims.unit",
"Steel.ST.GenArraySwap.Proof.jump_if",
"FStar.SizeT.v",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.nat",
"Steel.ST.GenArraySwap.Proof.jump"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d
#push-options "--z3rlimit 16"
#restart-solver
let gcd
(n0: SZ.t)
(l0: SZ.t)
: ST SZ.t
emp
(fun _ -> emp)
(SZ.v l0 < SZ.v n0)
(fun res -> gcd_post n0 l0 res)
= let res =
R.with_local n0 (fun pn ->
R.with_local l0 (fun pl ->
noop ();
rewrite (gcd_inv0 n0 l0 pn pl (l0 `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l0 `SZ.gt` 0sz));
Steel.ST.Loops.while_loop
(gcd_inv n0 l0 pn pl)
(fun _ ->
let gb = elim_exists () in
rewrite (gcd_inv n0 l0 pn pl gb) (gcd_inv0 n0 l0 pn pl gb);
let _ = gen_elim () in
let l = R.read pl in
[@@inline_let]
let b = l `SZ.gt` 0sz in
noop ();
rewrite (gcd_inv0 n0 l0 pn pl b) (gcd_inv n0 l0 pn pl b);
return b
)
(fun _ ->
rewrite (gcd_inv n0 l0 pn pl true) (gcd_inv0 n0 l0 pn pl true);
let _ = gen_elim () in
let n = R.read pn in
let l = R.read pl in
[@@inline_let]
let l' = SZ.rem n l in
R.write pn l;
R.write pl l';
rewrite (gcd_inv0 n0 l0 pn pl (l' `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l' `SZ.gt` 0sz));
noop ()
);
rewrite (gcd_inv n0 l0 pn pl false) (gcd_inv0 n0 l0 pn pl false);
let _ = gen_elim () in
let res = R.read pn in
return res
)
)
in
elim_pure (gcd_post n0 l0 res);
return res
#pop-options
let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
= n == Seq.length s0 /\
n == Seq.length s /\
0 < l /\
l < n /\
i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' < i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)
))) /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' > i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx
)))
let array_swap_inner_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(j: nat)
(idx: nat)
(b: bool)
: GTot prop
= Prf.array_swap_inner_invariant s0 n l bz s i j idx /\
(b == (j < bz.q_n - 1))
let array_swap_outer_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(b: bool)
: GTot prop
= Prf.array_swap_outer_invariant s0 n l bz s i /\
(b == (i < bz.d))
[@@__reduce__]
let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
=
R.pts_to pi full_perm i `star`
pts_to s
[@@erasable]
noeq
type array_swap_outer_invariant_t (t: Type)
= {
i: SZ.t;
s: Ghost.erased (Seq.seq t);
}
[@@__reduce__]
let array_swap_outer_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_outer_invariant_body0 pts_to pi w.i w.s `star`
pure (array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b)
)
let array_swap_outer_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_outer_invariant0 pts_to n l bz s0 pi b
let intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True)
= let w = {
i = i;
s = s;
}
in
rewrite (array_swap_outer_invariant_body0 pts_to pi i s) (array_swap_outer_invariant_body0 pts_to pi w.i w.s);
rewrite (array_swap_outer_invariant0 pts_to n l bz s0 pi b) (array_swap_outer_invariant pts_to n l bz s0 pi b)
let elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t) opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w ->
array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\
True // (b == false ==> Ghost.reveal w.s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l)))
)
= let w = elim_exists () in
let _ = gen_elim () in
// Classical.move_requires (array_swap_outer_invariant_prop_end (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i)) b;
noop ();
w
[@@erasable]
noeq
type array_swap_inner_invariant_t (t: Type)
= {
j: SZ.t;
idx: SZ.t;
s: Ghost.erased (Seq.seq t)
}
[@@__reduce__]
let array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
= R.pts_to pi full_perm i `star`
R.pts_to pj full_perm j `star`
R.pts_to pidx full_perm idx `star`
pts_to s
[@@__reduce__]
let array_swap_inner_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s `star`
pure (array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v i) (SZ.v w.j) (SZ.v w.idx) b)
)
let array_swap_inner_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_inner_invariant0 pts_to n l bz s0 pi i pj pidx b
let intro_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(fun _ -> array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) (SZ.v j) (SZ.v idx) b)
(fun _ -> True)
= let w = {
j = j;
idx = idx;
s = s;
}
in
rewrite
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s);
rewrite
(array_swap_inner_invariant0 pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
let elim_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_inner_invariant_t t) opened
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(fun w -> array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s)
True
(fun w -> array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v i) (SZ.v w.j) (SZ.v w.idx) b)
= let w = elim_exists () in
elim_pure _;
w
inline_for_extraction
let impl_jump
(n: SZ.t)
(l: SZ.t)
(idx: SZ.t)
: Pure SZ.t
(requires (
SZ.v l < SZ.v n /\
SZ.v idx < SZ.v n
))
(ensures (fun idx' ->
SZ.v idx' == Prf.jump (SZ.v n) (SZ.v l) (SZ.v idx) | false | false | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val impl_jump (n l idx: SZ.t)
: Pure SZ.t
(requires (SZ.v l < SZ.v n /\ SZ.v idx < SZ.v n))
(ensures (fun idx' -> SZ.v idx' == Prf.jump (SZ.v n) (SZ.v l) (SZ.v idx))) | [] | Steel.ST.GenArraySwap.impl_jump | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | n: FStar.SizeT.t -> l: FStar.SizeT.t -> idx: FStar.SizeT.t -> Prims.Pure FStar.SizeT.t | {
"end_col": 21,
"end_line": 394,
"start_col": 2,
"start_line": 389
} |
Steel.ST.Effect.Ghost.STGhost | val intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit
opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True) | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True)
= let w = {
i = i;
s = s;
}
in
rewrite (array_swap_outer_invariant_body0 pts_to pi i s) (array_swap_outer_invariant_body0 pts_to pi w.i w.s);
rewrite (array_swap_outer_invariant0 pts_to n l bz s0 pi b) (array_swap_outer_invariant pts_to n l bz s0 pi b) | val intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit
opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True)
let intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit
opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True) = | true | null | false | let w = { i = i; s = s } in
rewrite (array_swap_outer_invariant_body0 pts_to pi i s)
(array_swap_outer_invariant_body0 pts_to pi w.i w.s);
rewrite (array_swap_outer_invariant0 pts_to n l bz s0 pi b)
(array_swap_outer_invariant pts_to n l bz s0 pi b) | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [] | [
"Steel.Memory.inames",
"Steel.ST.GenArraySwap.array_pts_to_t",
"FStar.SizeT.t",
"Steel.ST.GenArraySwap.Proof.bezout",
"FStar.SizeT.v",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Steel.ST.Reference.ref",
"Prims.bool",
"Steel.ST.Util.rewrite",
"Steel.ST.GenArraySwap.array_swap_outer_invariant0",
"Steel.ST.GenArraySwap.array_swap_outer_invariant",
"Prims.unit",
"Steel.ST.GenArraySwap.array_swap_outer_invariant_body0",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_outer_invariant_t__item__i",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_outer_invariant_t__item__s",
"Steel.ST.GenArraySwap.array_swap_outer_invariant_t",
"Steel.ST.GenArraySwap.Mkarray_swap_outer_invariant_t",
"Steel.Effect.Common.vprop",
"Steel.ST.GenArraySwap.array_swap_outer_invariant_prop",
"Prims.l_True"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d
#push-options "--z3rlimit 16"
#restart-solver
let gcd
(n0: SZ.t)
(l0: SZ.t)
: ST SZ.t
emp
(fun _ -> emp)
(SZ.v l0 < SZ.v n0)
(fun res -> gcd_post n0 l0 res)
= let res =
R.with_local n0 (fun pn ->
R.with_local l0 (fun pl ->
noop ();
rewrite (gcd_inv0 n0 l0 pn pl (l0 `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l0 `SZ.gt` 0sz));
Steel.ST.Loops.while_loop
(gcd_inv n0 l0 pn pl)
(fun _ ->
let gb = elim_exists () in
rewrite (gcd_inv n0 l0 pn pl gb) (gcd_inv0 n0 l0 pn pl gb);
let _ = gen_elim () in
let l = R.read pl in
[@@inline_let]
let b = l `SZ.gt` 0sz in
noop ();
rewrite (gcd_inv0 n0 l0 pn pl b) (gcd_inv n0 l0 pn pl b);
return b
)
(fun _ ->
rewrite (gcd_inv n0 l0 pn pl true) (gcd_inv0 n0 l0 pn pl true);
let _ = gen_elim () in
let n = R.read pn in
let l = R.read pl in
[@@inline_let]
let l' = SZ.rem n l in
R.write pn l;
R.write pl l';
rewrite (gcd_inv0 n0 l0 pn pl (l' `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l' `SZ.gt` 0sz));
noop ()
);
rewrite (gcd_inv n0 l0 pn pl false) (gcd_inv0 n0 l0 pn pl false);
let _ = gen_elim () in
let res = R.read pn in
return res
)
)
in
elim_pure (gcd_post n0 l0 res);
return res
#pop-options
let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
= n == Seq.length s0 /\
n == Seq.length s /\
0 < l /\
l < n /\
i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' < i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)
))) /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' > i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx
)))
let array_swap_inner_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(j: nat)
(idx: nat)
(b: bool)
: GTot prop
= Prf.array_swap_inner_invariant s0 n l bz s i j idx /\
(b == (j < bz.q_n - 1))
let array_swap_outer_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(b: bool)
: GTot prop
= Prf.array_swap_outer_invariant s0 n l bz s i /\
(b == (i < bz.d))
[@@__reduce__]
let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
=
R.pts_to pi full_perm i `star`
pts_to s
[@@erasable]
noeq
type array_swap_outer_invariant_t (t: Type)
= {
i: SZ.t;
s: Ghost.erased (Seq.seq t);
}
[@@__reduce__]
let array_swap_outer_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_outer_invariant_body0 pts_to pi w.i w.s `star`
pure (array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b)
)
let array_swap_outer_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_outer_invariant0 pts_to n l bz s0 pi b
let intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b) | false | false | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit
opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True) | [] | Steel.ST.GenArraySwap.intro_array_swap_outer_invariant | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
pts_to: Steel.ST.GenArraySwap.array_pts_to_t t ->
n: FStar.SizeT.t ->
l: FStar.SizeT.t ->
bz: Steel.ST.GenArraySwap.Proof.bezout (FStar.SizeT.v n) (FStar.SizeT.v l) ->
s0: FStar.Ghost.erased (FStar.Seq.Base.seq t) ->
pi: Steel.ST.Reference.ref FStar.SizeT.t ->
b: Prims.bool ->
i: FStar.SizeT.t ->
s: FStar.Ghost.erased (FStar.Seq.Base.seq t)
-> Steel.ST.Effect.Ghost.STGhost Prims.unit | {
"end_col": 112,
"end_line": 229,
"start_col": 1,
"start_line": 223
} |
Steel.ST.Effect.Ghost.STGhost | val intro_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
(j idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit
opened
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(fun _ -> array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) (SZ.v j) (SZ.v idx) b)
(fun _ -> True) | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let intro_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(fun _ -> array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) (SZ.v j) (SZ.v idx) b)
(fun _ -> True)
= let w = {
j = j;
idx = idx;
s = s;
}
in
rewrite
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s);
rewrite
(array_swap_inner_invariant0 pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b) | val intro_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
(j idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit
opened
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(fun _ -> array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) (SZ.v j) (SZ.v idx) b)
(fun _ -> True)
let intro_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
(j idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit
opened
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(fun _ -> array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) (SZ.v j) (SZ.v idx) b)
(fun _ -> True) = | true | null | false | let w = { j = j; idx = idx; s = s } in
rewrite (array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s);
rewrite (array_swap_inner_invariant0 pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b) | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [] | [
"Steel.Memory.inames",
"Steel.ST.GenArraySwap.array_pts_to_t",
"FStar.SizeT.t",
"Steel.ST.GenArraySwap.Proof.bezout",
"FStar.SizeT.v",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Steel.ST.Reference.ref",
"Prims.bool",
"Steel.ST.Util.rewrite",
"Steel.ST.GenArraySwap.array_swap_inner_invariant0",
"Steel.ST.GenArraySwap.array_swap_inner_invariant",
"Prims.unit",
"Steel.ST.GenArraySwap.array_swap_inner_invariant_body0",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_inner_invariant_t__item__j",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_inner_invariant_t__item__idx",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_inner_invariant_t__item__s",
"Steel.ST.GenArraySwap.array_swap_inner_invariant_t",
"Steel.ST.GenArraySwap.Mkarray_swap_inner_invariant_t",
"Steel.Effect.Common.vprop",
"Steel.ST.GenArraySwap.array_swap_inner_invariant_prop",
"Prims.l_True"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d
#push-options "--z3rlimit 16"
#restart-solver
let gcd
(n0: SZ.t)
(l0: SZ.t)
: ST SZ.t
emp
(fun _ -> emp)
(SZ.v l0 < SZ.v n0)
(fun res -> gcd_post n0 l0 res)
= let res =
R.with_local n0 (fun pn ->
R.with_local l0 (fun pl ->
noop ();
rewrite (gcd_inv0 n0 l0 pn pl (l0 `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l0 `SZ.gt` 0sz));
Steel.ST.Loops.while_loop
(gcd_inv n0 l0 pn pl)
(fun _ ->
let gb = elim_exists () in
rewrite (gcd_inv n0 l0 pn pl gb) (gcd_inv0 n0 l0 pn pl gb);
let _ = gen_elim () in
let l = R.read pl in
[@@inline_let]
let b = l `SZ.gt` 0sz in
noop ();
rewrite (gcd_inv0 n0 l0 pn pl b) (gcd_inv n0 l0 pn pl b);
return b
)
(fun _ ->
rewrite (gcd_inv n0 l0 pn pl true) (gcd_inv0 n0 l0 pn pl true);
let _ = gen_elim () in
let n = R.read pn in
let l = R.read pl in
[@@inline_let]
let l' = SZ.rem n l in
R.write pn l;
R.write pl l';
rewrite (gcd_inv0 n0 l0 pn pl (l' `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l' `SZ.gt` 0sz));
noop ()
);
rewrite (gcd_inv n0 l0 pn pl false) (gcd_inv0 n0 l0 pn pl false);
let _ = gen_elim () in
let res = R.read pn in
return res
)
)
in
elim_pure (gcd_post n0 l0 res);
return res
#pop-options
let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
= n == Seq.length s0 /\
n == Seq.length s /\
0 < l /\
l < n /\
i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' < i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)
))) /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' > i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx
)))
let array_swap_inner_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(j: nat)
(idx: nat)
(b: bool)
: GTot prop
= Prf.array_swap_inner_invariant s0 n l bz s i j idx /\
(b == (j < bz.q_n - 1))
let array_swap_outer_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(b: bool)
: GTot prop
= Prf.array_swap_outer_invariant s0 n l bz s i /\
(b == (i < bz.d))
[@@__reduce__]
let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
=
R.pts_to pi full_perm i `star`
pts_to s
[@@erasable]
noeq
type array_swap_outer_invariant_t (t: Type)
= {
i: SZ.t;
s: Ghost.erased (Seq.seq t);
}
[@@__reduce__]
let array_swap_outer_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_outer_invariant_body0 pts_to pi w.i w.s `star`
pure (array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b)
)
let array_swap_outer_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_outer_invariant0 pts_to n l bz s0 pi b
let intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True)
= let w = {
i = i;
s = s;
}
in
rewrite (array_swap_outer_invariant_body0 pts_to pi i s) (array_swap_outer_invariant_body0 pts_to pi w.i w.s);
rewrite (array_swap_outer_invariant0 pts_to n l bz s0 pi b) (array_swap_outer_invariant pts_to n l bz s0 pi b)
let elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t) opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w ->
array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\
True // (b == false ==> Ghost.reveal w.s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l)))
)
= let w = elim_exists () in
let _ = gen_elim () in
// Classical.move_requires (array_swap_outer_invariant_prop_end (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i)) b;
noop ();
w
[@@erasable]
noeq
type array_swap_inner_invariant_t (t: Type)
= {
j: SZ.t;
idx: SZ.t;
s: Ghost.erased (Seq.seq t)
}
[@@__reduce__]
let array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
= R.pts_to pi full_perm i `star`
R.pts_to pj full_perm j `star`
R.pts_to pidx full_perm idx `star`
pts_to s
[@@__reduce__]
let array_swap_inner_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s `star`
pure (array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v i) (SZ.v w.j) (SZ.v w.idx) b)
)
let array_swap_inner_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_inner_invariant0 pts_to n l bz s0 pi i pj pidx b
let intro_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(fun _ -> array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) (SZ.v j) (SZ.v idx) b) | false | false | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val intro_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
(j idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit
opened
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(fun _ -> array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) (SZ.v j) (SZ.v idx) b)
(fun _ -> True) | [] | Steel.ST.GenArraySwap.intro_array_swap_inner_invariant | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
pts_to: Steel.ST.GenArraySwap.array_pts_to_t t ->
n: FStar.SizeT.t ->
l: FStar.SizeT.t ->
bz: Steel.ST.GenArraySwap.Proof.bezout (FStar.SizeT.v n) (FStar.SizeT.v l) ->
s0: FStar.Ghost.erased (FStar.Seq.Base.seq t) ->
pi: Steel.ST.Reference.ref FStar.SizeT.t ->
i: FStar.SizeT.t ->
pj: Steel.ST.Reference.ref FStar.SizeT.t ->
pidx: Steel.ST.Reference.ref FStar.SizeT.t ->
b: Prims.bool ->
j: FStar.SizeT.t ->
idx: FStar.SizeT.t ->
s: FStar.Ghost.erased (FStar.Seq.Base.seq t)
-> Steel.ST.Effect.Ghost.STGhost Prims.unit | {
"end_col": 64,
"end_line": 352,
"start_col": 1,
"start_line": 341
} |
Steel.ST.Effect.ST | val array_swap_gen
(#t: Type0)
(#pts_to: array_pts_to_t t)
(index: array_index_t pts_to)
(upd: array_upd_t pts_to)
(s0: Ghost.erased (Seq.seq t))
(n: SZ.t)
(l: SZ.t)
: ST (Ghost.erased (Seq.seq t))
(pts_to s0)
(fun s -> pts_to s)
(
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n
)
(fun s ->
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n /\
s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l))
) | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let array_swap_gen
(#t: Type)
(#pts_to: array_pts_to_t t)
(index: array_index_t pts_to)
(upd: array_upd_t pts_to)
(s0: Ghost.erased (Seq.seq t))
(n: SZ.t)
(l: SZ.t)
: ST (Ghost.erased (Seq.seq t))
(pts_to s0)
(fun s -> pts_to s)
(
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n
)
(fun s ->
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n /\
s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l))
)
= if l = 0sz || l = n
then begin
noop ();
return s0
end
else array_swap_aux index upd s0 n l | val array_swap_gen
(#t: Type0)
(#pts_to: array_pts_to_t t)
(index: array_index_t pts_to)
(upd: array_upd_t pts_to)
(s0: Ghost.erased (Seq.seq t))
(n: SZ.t)
(l: SZ.t)
: ST (Ghost.erased (Seq.seq t))
(pts_to s0)
(fun s -> pts_to s)
(
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n
)
(fun s ->
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n /\
s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l))
)
let array_swap_gen
(#t: Type)
(#pts_to: array_pts_to_t t)
(index: array_index_t pts_to)
(upd: array_upd_t pts_to)
(s0: Ghost.erased (Seq.seq t))
(n l: SZ.t)
: ST (Ghost.erased (Seq.seq t))
(pts_to s0)
(fun s -> pts_to s)
(SZ.v n == Seq.length s0 /\ SZ.v l <= SZ.v n)
(fun s ->
SZ.v n == Seq.length s0 /\ SZ.v l <= SZ.v n /\
s `Seq.equal` ((Seq.slice s0 (SZ.v l) (SZ.v n)) `Seq.append` (Seq.slice s0 0 (SZ.v l)))) = | true | null | false | if l = 0sz || l = n
then
(noop ();
return s0)
else array_swap_aux index upd s0 n l | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [] | [
"Steel.ST.GenArraySwap.array_pts_to_t",
"Steel.ST.GenArraySwap.array_index_t",
"Steel.ST.GenArraySwap.array_upd_t",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"FStar.SizeT.t",
"Prims.op_BarBar",
"Prims.op_Equality",
"FStar.SizeT.__uint_to_t",
"Steel.ST.Util.return",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"Steel.Effect.Common.vprop",
"Prims.unit",
"Steel.ST.Util.noop",
"Prims.bool",
"Steel.ST.GenArraySwap.array_swap_aux",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"FStar.SizeT.v",
"FStar.Seq.Base.length",
"FStar.Ghost.reveal",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_True",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.append",
"FStar.Seq.Base.slice"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d
#push-options "--z3rlimit 16"
#restart-solver
let gcd
(n0: SZ.t)
(l0: SZ.t)
: ST SZ.t
emp
(fun _ -> emp)
(SZ.v l0 < SZ.v n0)
(fun res -> gcd_post n0 l0 res)
= let res =
R.with_local n0 (fun pn ->
R.with_local l0 (fun pl ->
noop ();
rewrite (gcd_inv0 n0 l0 pn pl (l0 `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l0 `SZ.gt` 0sz));
Steel.ST.Loops.while_loop
(gcd_inv n0 l0 pn pl)
(fun _ ->
let gb = elim_exists () in
rewrite (gcd_inv n0 l0 pn pl gb) (gcd_inv0 n0 l0 pn pl gb);
let _ = gen_elim () in
let l = R.read pl in
[@@inline_let]
let b = l `SZ.gt` 0sz in
noop ();
rewrite (gcd_inv0 n0 l0 pn pl b) (gcd_inv n0 l0 pn pl b);
return b
)
(fun _ ->
rewrite (gcd_inv n0 l0 pn pl true) (gcd_inv0 n0 l0 pn pl true);
let _ = gen_elim () in
let n = R.read pn in
let l = R.read pl in
[@@inline_let]
let l' = SZ.rem n l in
R.write pn l;
R.write pl l';
rewrite (gcd_inv0 n0 l0 pn pl (l' `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l' `SZ.gt` 0sz));
noop ()
);
rewrite (gcd_inv n0 l0 pn pl false) (gcd_inv0 n0 l0 pn pl false);
let _ = gen_elim () in
let res = R.read pn in
return res
)
)
in
elim_pure (gcd_post n0 l0 res);
return res
#pop-options
let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
= n == Seq.length s0 /\
n == Seq.length s /\
0 < l /\
l < n /\
i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' < i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)
))) /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' > i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx
)))
let array_swap_inner_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(j: nat)
(idx: nat)
(b: bool)
: GTot prop
= Prf.array_swap_inner_invariant s0 n l bz s i j idx /\
(b == (j < bz.q_n - 1))
let array_swap_outer_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(b: bool)
: GTot prop
= Prf.array_swap_outer_invariant s0 n l bz s i /\
(b == (i < bz.d))
[@@__reduce__]
let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
=
R.pts_to pi full_perm i `star`
pts_to s
[@@erasable]
noeq
type array_swap_outer_invariant_t (t: Type)
= {
i: SZ.t;
s: Ghost.erased (Seq.seq t);
}
[@@__reduce__]
let array_swap_outer_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_outer_invariant_body0 pts_to pi w.i w.s `star`
pure (array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b)
)
let array_swap_outer_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_outer_invariant0 pts_to n l bz s0 pi b
let intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True)
= let w = {
i = i;
s = s;
}
in
rewrite (array_swap_outer_invariant_body0 pts_to pi i s) (array_swap_outer_invariant_body0 pts_to pi w.i w.s);
rewrite (array_swap_outer_invariant0 pts_to n l bz s0 pi b) (array_swap_outer_invariant pts_to n l bz s0 pi b)
let elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t) opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w ->
array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\
True // (b == false ==> Ghost.reveal w.s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l)))
)
= let w = elim_exists () in
let _ = gen_elim () in
// Classical.move_requires (array_swap_outer_invariant_prop_end (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i)) b;
noop ();
w
[@@erasable]
noeq
type array_swap_inner_invariant_t (t: Type)
= {
j: SZ.t;
idx: SZ.t;
s: Ghost.erased (Seq.seq t)
}
[@@__reduce__]
let array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
= R.pts_to pi full_perm i `star`
R.pts_to pj full_perm j `star`
R.pts_to pidx full_perm idx `star`
pts_to s
[@@__reduce__]
let array_swap_inner_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s `star`
pure (array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v i) (SZ.v w.j) (SZ.v w.idx) b)
)
let array_swap_inner_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_inner_invariant0 pts_to n l bz s0 pi i pj pidx b
let intro_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(fun _ -> array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) (SZ.v j) (SZ.v idx) b)
(fun _ -> True)
= let w = {
j = j;
idx = idx;
s = s;
}
in
rewrite
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s);
rewrite
(array_swap_inner_invariant0 pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
let elim_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_inner_invariant_t t) opened
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(fun w -> array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s)
True
(fun w -> array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v i) (SZ.v w.j) (SZ.v w.idx) b)
= let w = elim_exists () in
elim_pure _;
w
inline_for_extraction
let impl_jump
(n: SZ.t)
(l: SZ.t)
(idx: SZ.t)
: Pure SZ.t
(requires (
SZ.v l < SZ.v n /\
SZ.v idx < SZ.v n
))
(ensures (fun idx' ->
SZ.v idx' == Prf.jump (SZ.v n) (SZ.v l) (SZ.v idx)
))
= Prf.jump_if (SZ.v n) (SZ.v l) () (SZ.v idx);
[@@inline_let]
let nl = n `SZ.sub` l in
if idx `SZ.gte` nl
then idx `SZ.sub` nl
else idx `SZ.add` l
#push-options "--z3rlimit 96"
#restart-solver
inline_for_extraction
let array_swap_outer_body
(#t: Type)
(#pts_to: array_pts_to_t t)
(index: array_index_t pts_to)
(upd: array_upd_t pts_to)
(s0: Ghost.erased (Seq.seq t))
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(d: SZ.t)
(q: SZ.t)
(pi: R.ref SZ.t)
(sq: squash (
SZ.v d == bz.d /\
SZ.v q == bz.q_n
))
()
: STT unit
(array_swap_outer_invariant pts_to n l bz s0 pi true)
(fun _ -> exists_ (array_swap_outer_invariant pts_to n l bz s0 pi))
=
let _ = elim_array_swap_outer_invariant pts_to n l bz s0 pi true in
let _ = gen_elim () in
let i = R.read pi in
let s = vpattern_replace pts_to in
let save = index _ n i in
R.with_local 0sz (fun pj ->
R.with_local i (fun pidx ->
noop ();
intro_array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx (0 < bz.q_n - 1) _ _ _;
Steel.ST.Loops.while_loop
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx)
(fun _ ->
let gb = elim_exists () in
let _ = elim_array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx gb in
let j = R.read pj in
[@@inline_let]
let b = j `SZ.lt` (q `SZ.sub` 1sz) in
intro_array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b _ _ _;
return b
)
(fun _ ->
let _ = elim_array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx true in
let j = R.read pj in
let idx = R.read pidx in
let j' = j `SZ.add` 1sz in
let idx' = impl_jump n l idx in
let x = index _ n idx' in
let _ = upd _ n idx x in
R.write pj j';
R.write pidx idx';
intro_array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx (SZ.v j' < bz.q_n - 1) _ _ _;
noop ()
);
let _ = elim_array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx false in
let idx = R.read pidx in
let _ = upd _ n idx save in
[@@inline_let]
let i' = i `SZ.add` 1sz in
R.write pi i';
intro_array_swap_outer_invariant pts_to n l bz s0 pi (i' `SZ.lt` d) _ _;
noop ()
))
#restart-solver
inline_for_extraction
let array_swap_aux
(#t: Type)
(#pts_to: array_pts_to_t t)
(index: array_index_t pts_to)
(upd: array_upd_t pts_to)
(s0: Ghost.erased (Seq.seq t))
(n: SZ.t)
(l: SZ.t)
: ST (Ghost.erased (Seq.seq t))
(pts_to s0)
(fun s -> pts_to s)
(
SZ.v n == Seq.length s0 /\
SZ.v l > 0 /\
SZ.v l < SZ.v n
)
(fun s -> Prf.array_swap_post s0 (SZ.v n) (SZ.v l) s)
= let bz = Prf.mk_bezout (SZ.v n) (SZ.v l) in
let d = gcd n l in
let q = n `SZ.div` d in
let s = R.with_local #_ 0sz #_ #(Ghost.erased (Seq.seq t)) #(fun s -> pts_to s `star` pure (Prf.array_swap_post s0 (SZ.v n) (SZ.v l) s)) (fun pi ->
intro_array_swap_outer_invariant pts_to n l bz s0 pi true _ _;
Steel.ST.Loops.while_loop
(array_swap_outer_invariant pts_to n l bz s0 pi)
(fun _ ->
let gb = elim_exists () in
let _ = elim_array_swap_outer_invariant pts_to n l bz s0 pi gb in
let i = R.read pi in
[@@inline_let]
let b = i `SZ.lt` d in
intro_array_swap_outer_invariant pts_to n l bz s0 pi b _ _;
return b
)
(array_swap_outer_body index upd s0 n l bz d q pi ());
let _ = elim_array_swap_outer_invariant pts_to n l bz s0 pi false in
return _
)
in
elim_pure _;
return s
#pop-options
inline_for_extraction
let array_swap_gen
(#t: Type)
(#pts_to: array_pts_to_t t)
(index: array_index_t pts_to)
(upd: array_upd_t pts_to)
(s0: Ghost.erased (Seq.seq t))
(n: SZ.t)
(l: SZ.t)
: ST (Ghost.erased (Seq.seq t))
(pts_to s0)
(fun s -> pts_to s)
(
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n
)
(fun s ->
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n /\
s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l)) | false | false | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val array_swap_gen
(#t: Type0)
(#pts_to: array_pts_to_t t)
(index: array_index_t pts_to)
(upd: array_upd_t pts_to)
(s0: Ghost.erased (Seq.seq t))
(n: SZ.t)
(l: SZ.t)
: ST (Ghost.erased (Seq.seq t))
(pts_to s0)
(fun s -> pts_to s)
(
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n
)
(fun s ->
SZ.v n == Seq.length s0 /\
SZ.v l <= SZ.v n /\
s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l))
) | [] | Steel.ST.GenArraySwap.array_swap_gen | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
index: Steel.ST.GenArraySwap.array_index_t pts_to ->
upd: Steel.ST.GenArraySwap.array_upd_t pts_to ->
s0: FStar.Ghost.erased (FStar.Seq.Base.seq t) ->
n: FStar.SizeT.t ->
l: FStar.SizeT.t
-> Steel.ST.Effect.ST (FStar.Ghost.erased (FStar.Seq.Base.seq t)) | {
"end_col": 38,
"end_line": 535,
"start_col": 2,
"start_line": 530
} |
Steel.ST.Effect.Ghost.STGhost | val elim_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_inner_invariant_t t)
opened
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(fun w -> array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s)
True
(fun w ->
array_swap_inner_invariant_prop (SZ.v n)
(SZ.v l)
bz
s0
w.s
(SZ.v i)
(SZ.v w.j)
(SZ.v w.idx)
b) | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let elim_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_inner_invariant_t t) opened
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(fun w -> array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s)
True
(fun w -> array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v i) (SZ.v w.j) (SZ.v w.idx) b)
= let w = elim_exists () in
elim_pure _;
w | val elim_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_inner_invariant_t t)
opened
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(fun w -> array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s)
True
(fun w ->
array_swap_inner_invariant_prop (SZ.v n)
(SZ.v l)
bz
s0
w.s
(SZ.v i)
(SZ.v w.j)
(SZ.v w.idx)
b)
let elim_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_inner_invariant_t t)
opened
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(fun w -> array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s)
True
(fun w ->
array_swap_inner_invariant_prop (SZ.v n)
(SZ.v l)
bz
s0
w.s
(SZ.v i)
(SZ.v w.j)
(SZ.v w.idx)
b) = | true | null | false | let w = elim_exists () in
elim_pure _;
w | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [] | [
"Steel.Memory.inames",
"Steel.ST.GenArraySwap.array_pts_to_t",
"FStar.SizeT.t",
"Steel.ST.GenArraySwap.Proof.bezout",
"FStar.SizeT.v",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Steel.ST.Reference.ref",
"Prims.bool",
"FStar.Ghost.reveal",
"Steel.ST.GenArraySwap.array_swap_inner_invariant_t",
"Prims.unit",
"Steel.ST.Util.elim_pure",
"Steel.ST.GenArraySwap.array_swap_inner_invariant_prop",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_inner_invariant_t__item__s",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_inner_invariant_t__item__j",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_inner_invariant_t__item__idx",
"Steel.ST.Util.elim_exists",
"Steel.Effect.Common.star",
"Steel.ST.GenArraySwap.array_swap_inner_invariant_body0",
"Steel.ST.Util.pure",
"Steel.Effect.Common.vprop",
"Steel.ST.GenArraySwap.array_swap_inner_invariant",
"Prims.l_True"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d
#push-options "--z3rlimit 16"
#restart-solver
let gcd
(n0: SZ.t)
(l0: SZ.t)
: ST SZ.t
emp
(fun _ -> emp)
(SZ.v l0 < SZ.v n0)
(fun res -> gcd_post n0 l0 res)
= let res =
R.with_local n0 (fun pn ->
R.with_local l0 (fun pl ->
noop ();
rewrite (gcd_inv0 n0 l0 pn pl (l0 `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l0 `SZ.gt` 0sz));
Steel.ST.Loops.while_loop
(gcd_inv n0 l0 pn pl)
(fun _ ->
let gb = elim_exists () in
rewrite (gcd_inv n0 l0 pn pl gb) (gcd_inv0 n0 l0 pn pl gb);
let _ = gen_elim () in
let l = R.read pl in
[@@inline_let]
let b = l `SZ.gt` 0sz in
noop ();
rewrite (gcd_inv0 n0 l0 pn pl b) (gcd_inv n0 l0 pn pl b);
return b
)
(fun _ ->
rewrite (gcd_inv n0 l0 pn pl true) (gcd_inv0 n0 l0 pn pl true);
let _ = gen_elim () in
let n = R.read pn in
let l = R.read pl in
[@@inline_let]
let l' = SZ.rem n l in
R.write pn l;
R.write pl l';
rewrite (gcd_inv0 n0 l0 pn pl (l' `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l' `SZ.gt` 0sz));
noop ()
);
rewrite (gcd_inv n0 l0 pn pl false) (gcd_inv0 n0 l0 pn pl false);
let _ = gen_elim () in
let res = R.read pn in
return res
)
)
in
elim_pure (gcd_post n0 l0 res);
return res
#pop-options
let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
= n == Seq.length s0 /\
n == Seq.length s /\
0 < l /\
l < n /\
i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' < i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)
))) /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' > i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx
)))
let array_swap_inner_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(j: nat)
(idx: nat)
(b: bool)
: GTot prop
= Prf.array_swap_inner_invariant s0 n l bz s i j idx /\
(b == (j < bz.q_n - 1))
let array_swap_outer_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(b: bool)
: GTot prop
= Prf.array_swap_outer_invariant s0 n l bz s i /\
(b == (i < bz.d))
[@@__reduce__]
let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
=
R.pts_to pi full_perm i `star`
pts_to s
[@@erasable]
noeq
type array_swap_outer_invariant_t (t: Type)
= {
i: SZ.t;
s: Ghost.erased (Seq.seq t);
}
[@@__reduce__]
let array_swap_outer_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_outer_invariant_body0 pts_to pi w.i w.s `star`
pure (array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b)
)
let array_swap_outer_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_outer_invariant0 pts_to n l bz s0 pi b
let intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True)
= let w = {
i = i;
s = s;
}
in
rewrite (array_swap_outer_invariant_body0 pts_to pi i s) (array_swap_outer_invariant_body0 pts_to pi w.i w.s);
rewrite (array_swap_outer_invariant0 pts_to n l bz s0 pi b) (array_swap_outer_invariant pts_to n l bz s0 pi b)
let elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t) opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w ->
array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\
True // (b == false ==> Ghost.reveal w.s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l)))
)
= let w = elim_exists () in
let _ = gen_elim () in
// Classical.move_requires (array_swap_outer_invariant_prop_end (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i)) b;
noop ();
w
[@@erasable]
noeq
type array_swap_inner_invariant_t (t: Type)
= {
j: SZ.t;
idx: SZ.t;
s: Ghost.erased (Seq.seq t)
}
[@@__reduce__]
let array_swap_inner_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
= R.pts_to pi full_perm i `star`
R.pts_to pj full_perm j `star`
R.pts_to pidx full_perm idx `star`
pts_to s
[@@__reduce__]
let array_swap_inner_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s `star`
pure (array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v i) (SZ.v w.j) (SZ.v w.idx) b)
)
let array_swap_inner_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_inner_invariant0 pts_to n l bz s0 pi i pj pidx b
let intro_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
(j: SZ.t)
(idx: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(fun _ -> array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) (SZ.v j) (SZ.v idx) b)
(fun _ -> True)
= let w = {
j = j;
idx = idx;
s = s;
}
in
rewrite
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b j idx s)
(array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s);
rewrite
(array_swap_inner_invariant0 pts_to n l bz s0 pi i pj pidx b)
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
let elim_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj: R.ref SZ.t)
(pidx: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_inner_invariant_t t) opened
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(fun w -> array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s)
True | false | false | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val elim_array_swap_inner_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(i: SZ.t)
(pj pidx: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_inner_invariant_t t)
opened
(array_swap_inner_invariant pts_to n l bz s0 pi i pj pidx b)
(fun w -> array_swap_inner_invariant_body0 pts_to n l bz s0 pi i pj pidx b w.j w.idx w.s)
True
(fun w ->
array_swap_inner_invariant_prop (SZ.v n)
(SZ.v l)
bz
s0
w.s
(SZ.v i)
(SZ.v w.j)
(SZ.v w.idx)
b) | [] | Steel.ST.GenArraySwap.elim_array_swap_inner_invariant | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
pts_to: Steel.ST.GenArraySwap.array_pts_to_t t ->
n: FStar.SizeT.t ->
l: FStar.SizeT.t ->
bz: Steel.ST.GenArraySwap.Proof.bezout (FStar.SizeT.v n) (FStar.SizeT.v l) ->
s0: FStar.Ghost.erased (FStar.Seq.Base.seq t) ->
pi: Steel.ST.Reference.ref FStar.SizeT.t ->
i: FStar.SizeT.t ->
pj: Steel.ST.Reference.ref FStar.SizeT.t ->
pidx: Steel.ST.Reference.ref FStar.SizeT.t ->
b: Prims.bool
-> Steel.ST.Effect.Ghost.STGhost (Steel.ST.GenArraySwap.array_swap_inner_invariant_t t) | {
"end_col": 3,
"end_line": 374,
"start_col": 1,
"start_line": 372
} |
Steel.ST.Effect.Ghost.STGhost | val elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t)
opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w -> array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\ True) | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.GenArraySwap.Proof",
"short_module": "Prf"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t) opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w ->
array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\
True // (b == false ==> Ghost.reveal w.s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l)))
)
= let w = elim_exists () in
let _ = gen_elim () in
// Classical.move_requires (array_swap_outer_invariant_prop_end (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i)) b;
noop ();
w | val elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t)
opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w -> array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\ True)
let elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t)
opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w -> array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\ True) = | true | null | false | let w = elim_exists () in
let _ = gen_elim () in
noop ();
w | {
"checked_file": "Steel.ST.GenArraySwap.fst.checked",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.GenArraySwap.Proof.fst.checked",
"prims.fst.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenArraySwap.fst"
} | [] | [
"Steel.Memory.inames",
"Steel.ST.GenArraySwap.array_pts_to_t",
"FStar.SizeT.t",
"Steel.ST.GenArraySwap.Proof.bezout",
"FStar.SizeT.v",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Steel.ST.Reference.ref",
"Prims.bool",
"FStar.Ghost.reveal",
"Steel.ST.GenArraySwap.array_swap_outer_invariant_t",
"Prims.unit",
"Steel.ST.Util.noop",
"Steel.ST.GenElim.gen_elim",
"Steel.Effect.Common.VStar",
"Steel.ST.Util.pure",
"Steel.ST.GenArraySwap.array_swap_outer_invariant_prop",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_outer_invariant_t__item__s",
"Steel.ST.GenArraySwap.__proj__Mkarray_swap_outer_invariant_t__item__i",
"Steel.ST.Reference.pts_to",
"Steel.FractionalPermission.full_perm",
"Steel.Effect.Common.star",
"Steel.Effect.Common.emp",
"Steel.Effect.Common.vprop",
"Prims.l_and",
"Prims.l_True",
"Prims.prop",
"Steel.ST.Util.elim_exists",
"Steel.ST.GenArraySwap.array_swap_outer_invariant_body0",
"Steel.ST.GenArraySwap.array_swap_outer_invariant"
] | [] | module Steel.ST.GenArraySwap
open Steel.ST.GenElim
module Prf = Steel.ST.GenArraySwap.Proof
module R = Steel.ST.Reference
let gcd_inv_prop
(n0: nat)
(l0: nat)
(n: nat)
(l: nat)
(b: bool)
: Tot prop
= l0 < n0 /\
l < n /\
(Prf.mk_bezout n0 l0).d == (Prf.mk_bezout n l).d /\
b == (l > 0)
[@@__reduce__]
let gcd_inv0
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun n -> exists_ (fun l ->
R.pts_to pn full_perm n `star`
R.pts_to pl full_perm l `star`
pure (gcd_inv_prop (SZ.v n0) (SZ.v l0) (SZ.v n) (SZ.v l) b)
))
let gcd_inv
(n0: SZ.t)
(l0: SZ.t)
(pn: R.ref SZ.t)
(pl: R.ref SZ.t)
(b: bool)
: Tot vprop
= gcd_inv0 n0 l0 pn pl b
let gcd_post
(n0: SZ.t)
(l0: SZ.t)
(res: SZ.t)
: Tot prop
= SZ.v l0 < SZ.v n0 /\
SZ.v res == (Prf.mk_bezout (SZ.v n0) (SZ.v l0)).d
#push-options "--z3rlimit 16"
#restart-solver
let gcd
(n0: SZ.t)
(l0: SZ.t)
: ST SZ.t
emp
(fun _ -> emp)
(SZ.v l0 < SZ.v n0)
(fun res -> gcd_post n0 l0 res)
= let res =
R.with_local n0 (fun pn ->
R.with_local l0 (fun pl ->
noop ();
rewrite (gcd_inv0 n0 l0 pn pl (l0 `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l0 `SZ.gt` 0sz));
Steel.ST.Loops.while_loop
(gcd_inv n0 l0 pn pl)
(fun _ ->
let gb = elim_exists () in
rewrite (gcd_inv n0 l0 pn pl gb) (gcd_inv0 n0 l0 pn pl gb);
let _ = gen_elim () in
let l = R.read pl in
[@@inline_let]
let b = l `SZ.gt` 0sz in
noop ();
rewrite (gcd_inv0 n0 l0 pn pl b) (gcd_inv n0 l0 pn pl b);
return b
)
(fun _ ->
rewrite (gcd_inv n0 l0 pn pl true) (gcd_inv0 n0 l0 pn pl true);
let _ = gen_elim () in
let n = R.read pn in
let l = R.read pl in
[@@inline_let]
let l' = SZ.rem n l in
R.write pn l;
R.write pl l';
rewrite (gcd_inv0 n0 l0 pn pl (l' `SZ.gt` 0sz)) (gcd_inv n0 l0 pn pl (l' `SZ.gt` 0sz));
noop ()
);
rewrite (gcd_inv n0 l0 pn pl false) (gcd_inv0 n0 l0 pn pl false);
let _ = gen_elim () in
let res = R.read pn in
return res
)
)
in
elim_pure (gcd_post n0 l0 res);
return res
#pop-options
let array_swap_partial_invariant
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
: GTot prop
= n == Seq.length s0 /\
n == Seq.length s /\
0 < l /\
l < n /\
i <= bz.d /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' < i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 (Prf.jump n l idx)
))) /\
(forall (i': Prf.nat_up_to bz.d) .
(forall (j: Prf.nat_up_to bz.q_n) .
(i' > i) ==> (
let idx = Prf.iter_fun #(Prf.nat_up_to n) (Prf.jump n l) j i' in
Seq.index s idx == Seq.index s0 idx
)))
let array_swap_inner_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(j: nat)
(idx: nat)
(b: bool)
: GTot prop
= Prf.array_swap_inner_invariant s0 n l bz s i j idx /\
(b == (j < bz.q_n - 1))
let array_swap_outer_invariant_prop
(#t: Type)
(n: nat)
(l: nat)
(bz: Prf.bezout n l)
(s0: Ghost.erased (Seq.seq t))
(s: Ghost.erased (Seq.seq t))
(i: nat)
(b: bool)
: GTot prop
= Prf.array_swap_outer_invariant s0 n l bz s i /\
(b == (i < bz.d))
[@@__reduce__]
let array_swap_outer_invariant_body0
(#t: Type)
(pts_to: array_pts_to_t t)
(pi: R.ref SZ.t)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: Tot vprop
=
R.pts_to pi full_perm i `star`
pts_to s
[@@erasable]
noeq
type array_swap_outer_invariant_t (t: Type)
= {
i: SZ.t;
s: Ghost.erased (Seq.seq t);
}
[@@__reduce__]
let array_swap_outer_invariant0
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= exists_ (fun w ->
array_swap_outer_invariant_body0 pts_to pi w.i w.s `star`
pure (array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b)
)
let array_swap_outer_invariant
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: Tot vprop
= array_swap_outer_invariant0 pts_to n l bz s0 pi b
let intro_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
(i: SZ.t)
(s: Ghost.erased (Seq.seq t))
: STGhost unit opened
(array_swap_outer_invariant_body0 pts_to pi i s)
(fun _ -> array_swap_outer_invariant pts_to n l bz s0 pi b)
(array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 s (SZ.v i) b)
(fun _ -> True)
= let w = {
i = i;
s = s;
}
in
rewrite (array_swap_outer_invariant_body0 pts_to pi i s) (array_swap_outer_invariant_body0 pts_to pi w.i w.s);
rewrite (array_swap_outer_invariant0 pts_to n l bz s0 pi b) (array_swap_outer_invariant pts_to n l bz s0 pi b)
let elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n: SZ.t)
(l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t) opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w ->
array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\
True // (b == false ==> Ghost.reveal w.s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l))) | false | false | Steel.ST.GenArraySwap.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val elim_array_swap_outer_invariant
(#opened: _)
(#t: Type)
(pts_to: array_pts_to_t t)
(n l: SZ.t)
(bz: Prf.bezout (SZ.v n) (SZ.v l))
(s0: Ghost.erased (Seq.seq t))
(pi: R.ref SZ.t)
(b: bool)
: STGhost (array_swap_outer_invariant_t t)
opened
(array_swap_outer_invariant pts_to n l bz s0 pi b)
(fun w -> array_swap_outer_invariant_body0 pts_to pi w.i w.s)
True
(fun w -> array_swap_outer_invariant_prop (SZ.v n) (SZ.v l) bz s0 w.s (SZ.v w.i) b /\ True) | [] | Steel.ST.GenArraySwap.elim_array_swap_outer_invariant | {
"file_name": "lib/steel/Steel.ST.GenArraySwap.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
pts_to: Steel.ST.GenArraySwap.array_pts_to_t t ->
n: FStar.SizeT.t ->
l: FStar.SizeT.t ->
bz: Steel.ST.GenArraySwap.Proof.bezout (FStar.SizeT.v n) (FStar.SizeT.v l) ->
s0: FStar.Ghost.erased (FStar.Seq.Base.seq t) ->
pi: Steel.ST.Reference.ref FStar.SizeT.t ->
b: Prims.bool
-> Steel.ST.Effect.Ghost.STGhost (Steel.ST.GenArraySwap.array_swap_outer_invariant_t t) | {
"end_col": 3,
"end_line": 253,
"start_col": 1,
"start_line": 249
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let predicate (a:Type u#a) = a -> Type0 | let predicate (a: Type u#a) = | false | null | false | a -> Type0 | {
"checked_file": "FStar.ReflexiveTransitiveClosure.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.ReflexiveTransitiveClosure.fsti"
} | [
"total"
] | [] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.ReflexiveTransitiveClosure
/// This module defines the reflexive transitive closure of a
/// relation. That is, the smallest preorder that includes it.
///
/// Closures are convenient for defining monotonic memory references:
///
/// - Define a `step` relation and take `closure step` as the
/// monotonic relation of the reference.
///
/// - To witness a property of the value of the reference, one must
/// show that the property is stable with respect to `closure step`,
/// but this boils down to proving that is stable with respect to
/// `step` (see lemma `stable_on_closure` below).
///
/// See examples/preorder/Closure.fst for usage examples.
let binrel (a:Type) = a -> a -> Type | false | true | FStar.ReflexiveTransitiveClosure.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val predicate : a: Type -> Type | [] | FStar.ReflexiveTransitiveClosure.predicate | {
"file_name": "ulib/FStar.ReflexiveTransitiveClosure.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: Type -> Type | {
"end_col": 39,
"end_line": 35,
"start_col": 29,
"start_line": 35
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let binrel (a:Type) = a -> a -> Type | let binrel (a: Type) = | false | null | false | a -> a -> Type | {
"checked_file": "FStar.ReflexiveTransitiveClosure.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.ReflexiveTransitiveClosure.fsti"
} | [
"total"
] | [] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.ReflexiveTransitiveClosure
/// This module defines the reflexive transitive closure of a
/// relation. That is, the smallest preorder that includes it.
///
/// Closures are convenient for defining monotonic memory references:
///
/// - Define a `step` relation and take `closure step` as the
/// monotonic relation of the reference.
///
/// - To witness a property of the value of the reference, one must
/// show that the property is stable with respect to `closure step`,
/// but this boils down to proving that is stable with respect to
/// `step` (see lemma `stable_on_closure` below).
///
/// See examples/preorder/Closure.fst for usage examples. | false | true | FStar.ReflexiveTransitiveClosure.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val binrel : a: Type -> Type | [] | FStar.ReflexiveTransitiveClosure.binrel | {
"file_name": "ulib/FStar.ReflexiveTransitiveClosure.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: Type -> Type | {
"end_col": 36,
"end_line": 33,
"start_col": 22,
"start_line": 33
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reflexive (#a:Type) (rel:binrel u#a u#r a) =
forall (x:a). squash (rel x x) | let reflexive (#a: Type) (rel: binrel u#a u#r a) = | false | null | false | forall (x: a). squash (rel x x) | {
"checked_file": "FStar.ReflexiveTransitiveClosure.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.ReflexiveTransitiveClosure.fsti"
} | [
"total"
] | [
"FStar.ReflexiveTransitiveClosure.binrel",
"Prims.l_Forall",
"Prims.squash",
"Prims.logical"
] | [] | (*
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.ReflexiveTransitiveClosure
/// This module defines the reflexive transitive closure of a
/// relation. That is, the smallest preorder that includes it.
///
/// Closures are convenient for defining monotonic memory references:
///
/// - Define a `step` relation and take `closure step` as the
/// monotonic relation of the reference.
///
/// - To witness a property of the value of the reference, one must
/// show that the property is stable with respect to `closure step`,
/// but this boils down to proving that is stable with respect to
/// `step` (see lemma `stable_on_closure` below).
///
/// See examples/preorder/Closure.fst for usage examples.
let binrel (a:Type) = a -> a -> Type
let predicate (a:Type u#a) = a -> Type0 | false | false | FStar.ReflexiveTransitiveClosure.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val reflexive : rel: FStar.ReflexiveTransitiveClosure.binrel a -> Prims.logical | [] | FStar.ReflexiveTransitiveClosure.reflexive | {
"file_name": "ulib/FStar.ReflexiveTransitiveClosure.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | rel: FStar.ReflexiveTransitiveClosure.binrel a -> Prims.logical | {
"end_col": 32,
"end_line": 38,
"start_col": 2,
"start_line": 38
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let transitive (#a:Type) (rel:binrel u#a u#r a) =
forall (x:a) (y:a) (z:a). (squash (rel x y) /\ squash (rel y z)) ==> squash (rel x z) | let transitive (#a: Type) (rel: binrel u#a u#r a) = | false | null | false | forall (x: a) (y: a) (z: a). (squash (rel x y) /\ squash (rel y z)) ==> squash (rel x z) | {
"checked_file": "FStar.ReflexiveTransitiveClosure.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.ReflexiveTransitiveClosure.fsti"
} | [
"total"
] | [
"FStar.ReflexiveTransitiveClosure.binrel",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.l_and",
"Prims.squash",
"Prims.logical"
] | [] | (*
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.ReflexiveTransitiveClosure
/// This module defines the reflexive transitive closure of a
/// relation. That is, the smallest preorder that includes it.
///
/// Closures are convenient for defining monotonic memory references:
///
/// - Define a `step` relation and take `closure step` as the
/// monotonic relation of the reference.
///
/// - To witness a property of the value of the reference, one must
/// show that the property is stable with respect to `closure step`,
/// but this boils down to proving that is stable with respect to
/// `step` (see lemma `stable_on_closure` below).
///
/// See examples/preorder/Closure.fst for usage examples.
let binrel (a:Type) = a -> a -> Type
let predicate (a:Type u#a) = a -> Type0
let reflexive (#a:Type) (rel:binrel u#a u#r a) =
forall (x:a). squash (rel x x) | false | false | FStar.ReflexiveTransitiveClosure.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val transitive : rel: FStar.ReflexiveTransitiveClosure.binrel a -> Prims.logical | [] | FStar.ReflexiveTransitiveClosure.transitive | {
"file_name": "ulib/FStar.ReflexiveTransitiveClosure.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | rel: FStar.ReflexiveTransitiveClosure.binrel a -> Prims.logical | {
"end_col": 87,
"end_line": 41,
"start_col": 2,
"start_line": 41
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let preorder_rel (#a:Type) (rel:binrel u#a u#r a) =
reflexive rel /\ transitive rel | let preorder_rel (#a: Type) (rel: binrel u#a u#r a) = | false | null | false | reflexive rel /\ transitive rel | {
"checked_file": "FStar.ReflexiveTransitiveClosure.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.ReflexiveTransitiveClosure.fsti"
} | [
"total"
] | [
"FStar.ReflexiveTransitiveClosure.binrel",
"Prims.l_and",
"FStar.ReflexiveTransitiveClosure.reflexive",
"FStar.ReflexiveTransitiveClosure.transitive",
"Prims.logical"
] | [] | (*
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.ReflexiveTransitiveClosure
/// This module defines the reflexive transitive closure of a
/// relation. That is, the smallest preorder that includes it.
///
/// Closures are convenient for defining monotonic memory references:
///
/// - Define a `step` relation and take `closure step` as the
/// monotonic relation of the reference.
///
/// - To witness a property of the value of the reference, one must
/// show that the property is stable with respect to `closure step`,
/// but this boils down to proving that is stable with respect to
/// `step` (see lemma `stable_on_closure` below).
///
/// See examples/preorder/Closure.fst for usage examples.
let binrel (a:Type) = a -> a -> Type
let predicate (a:Type u#a) = a -> Type0
let reflexive (#a:Type) (rel:binrel u#a u#r a) =
forall (x:a). squash (rel x x)
let transitive (#a:Type) (rel:binrel u#a u#r a) =
forall (x:a) (y:a) (z:a). (squash (rel x y) /\ squash (rel y z)) ==> squash (rel x z) | false | false | FStar.ReflexiveTransitiveClosure.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val preorder_rel : rel: FStar.ReflexiveTransitiveClosure.binrel a -> Prims.logical | [] | FStar.ReflexiveTransitiveClosure.preorder_rel | {
"file_name": "ulib/FStar.ReflexiveTransitiveClosure.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | rel: FStar.ReflexiveTransitiveClosure.binrel a -> Prims.logical | {
"end_col": 33,
"end_line": 44,
"start_col": 2,
"start_line": 44
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let stable (#a:Type u#a) (p:a -> Type0) (rel:binrel u#a u#r a{preorder_rel rel}) =
forall (x:a) (y:a). (p x /\ squash (rel x y)) ==> p y | let stable (#a: Type u#a) (p: (a -> Type0)) (rel: binrel u#a u#r a {preorder_rel rel}) = | false | null | false | forall (x: a) (y: a). (p x /\ squash (rel x y)) ==> p y | {
"checked_file": "FStar.ReflexiveTransitiveClosure.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.ReflexiveTransitiveClosure.fsti"
} | [
"total"
] | [
"FStar.ReflexiveTransitiveClosure.binrel",
"FStar.ReflexiveTransitiveClosure.preorder_rel",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.l_and",
"Prims.squash",
"Prims.logical"
] | [] | (*
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.ReflexiveTransitiveClosure
/// This module defines the reflexive transitive closure of a
/// relation. That is, the smallest preorder that includes it.
///
/// Closures are convenient for defining monotonic memory references:
///
/// - Define a `step` relation and take `closure step` as the
/// monotonic relation of the reference.
///
/// - To witness a property of the value of the reference, one must
/// show that the property is stable with respect to `closure step`,
/// but this boils down to proving that is stable with respect to
/// `step` (see lemma `stable_on_closure` below).
///
/// See examples/preorder/Closure.fst for usage examples.
let binrel (a:Type) = a -> a -> Type
let predicate (a:Type u#a) = a -> Type0
let reflexive (#a:Type) (rel:binrel u#a u#r a) =
forall (x:a). squash (rel x x)
let transitive (#a:Type) (rel:binrel u#a u#r a) =
forall (x:a) (y:a) (z:a). (squash (rel x y) /\ squash (rel y z)) ==> squash (rel x z)
let preorder_rel (#a:Type) (rel:binrel u#a u#r a) =
reflexive rel /\ transitive rel
type preorder (a:Type u#a) : Type u#(max a (1 + r)) = rel:binrel u#a u#r a{preorder_rel rel} | false | false | FStar.ReflexiveTransitiveClosure.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val stable : p: (_: a -> Type0) ->
rel:
FStar.ReflexiveTransitiveClosure.binrel a {FStar.ReflexiveTransitiveClosure.preorder_rel rel}
-> Prims.logical | [] | FStar.ReflexiveTransitiveClosure.stable | {
"file_name": "ulib/FStar.ReflexiveTransitiveClosure.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} |
p: (_: a -> Type0) ->
rel:
FStar.ReflexiveTransitiveClosure.binrel a {FStar.ReflexiveTransitiveClosure.preorder_rel rel}
-> Prims.logical | {
"end_col": 55,
"end_line": 49,
"start_col": 2,
"start_line": 49
} |
|
Prims.Tot | val serialize32_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{ let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\ Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <
4294967296 /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <
4294967296 })
(st32: serializer32 s.serialize_ifthenelse_tag_serializer)
(syntt:
(x: p.parse_ifthenelse_t
-> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})
))
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(syntp:
(
b: bool ->
x:
p.parse_ifthenelse_t
{b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}
-> Tot
(pl:
p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}
)))
(sp32: (b: bool -> Tot (serializer32 (s.serialize_ifthenelse_payload_serializer b))))
: Tot (serializer32 (serialize_ifthenelse s)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.SLow.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.IfThenElse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize32_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p {
let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\
Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high < 4294967296 /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high < 4294967296
})
(st32: serializer32 s.serialize_ifthenelse_tag_serializer)
(syntt: (x: p.parse_ifthenelse_t) -> Tot (t: p.parse_ifthenelse_tag_t { t == dfst (s.serialize_ifthenelse_synth_recip x) } ))
(b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))
(syntp: (b: bool) -> (x: p.parse_ifthenelse_t { b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x)) } ) -> Tot (pl: p.parse_ifthenelse_payload_t b { pl == dsnd (s.serialize_ifthenelse_synth_recip x) } ))
(sp32: (b: bool) -> Tot (serializer32 (s.serialize_ifthenelse_payload_serializer b)))
: Tot (serializer32 (serialize_ifthenelse s))
= fun (input: p.parse_ifthenelse_t) -> ((
let t = syntt input in
let st = st32 t in
let b = b32 t in
if b
then
let y = syntp true input in
B32.append st (sp32 true y)
else
let y = syntp false input in
B32.append st (sp32 false y)
) <: (res: _ { serializer32_correct (serialize_ifthenelse s) input res })) | val serialize32_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{ let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\ Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <
4294967296 /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <
4294967296 })
(st32: serializer32 s.serialize_ifthenelse_tag_serializer)
(syntt:
(x: p.parse_ifthenelse_t
-> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})
))
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(syntp:
(
b: bool ->
x:
p.parse_ifthenelse_t
{b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}
-> Tot
(pl:
p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}
)))
(sp32: (b: bool -> Tot (serializer32 (s.serialize_ifthenelse_payload_serializer b))))
: Tot (serializer32 (serialize_ifthenelse s))
let serialize32_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{ let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\ Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <
4294967296 /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <
4294967296 })
(st32: serializer32 s.serialize_ifthenelse_tag_serializer)
(syntt:
(x: p.parse_ifthenelse_t
-> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})
))
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(syntp:
(
b: bool ->
x:
p.parse_ifthenelse_t
{b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}
-> Tot
(pl:
p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}
)))
(sp32: (b: bool -> Tot (serializer32 (s.serialize_ifthenelse_payload_serializer b))))
: Tot (serializer32 (serialize_ifthenelse s)) = | false | null | false | fun (input: p.parse_ifthenelse_t) ->
((let t = syntt input in
let st = st32 t in
let b = b32 t in
if b
then
let y = syntp true input in
B32.append st (sp32 true y)
else
let y = syntp false input in
B32.append st (sp32 false y))
<:
(res: _{serializer32_correct (serialize_ifthenelse s) input res})) | {
"checked_file": "LowParse.SLow.IfThenElse.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.IfThenElse.fst.checked",
"LowParse.SLow.Combinators.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.IfThenElse.fst"
} | [
"total"
] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.IfThenElse.serialize_ifthenelse_param",
"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",
"FStar.Pervasives.Native.uu___is_Some",
"Prims.nat",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high",
"FStar.Pervasives.dfst",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser",
"Prims.op_LessThan",
"Prims.op_Addition",
"FStar.Pervasives.Native.__proj__Some__item__v",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_kind",
"LowParse.SLow.Base.serializer32",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_parser",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_tag_serializer",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_synth_recip",
"Prims.bool",
"FStar.Pervasives.dsnd",
"Prims.__proj__Mkdtuple2__item___1",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_payload_serializer",
"FStar.Bytes.append",
"LowParse.SLow.Base.bytes32",
"LowParse.SLow.Base.serializer32_correct",
"LowParse.Spec.IfThenElse.parse_ifthenelse_kind",
"LowParse.Spec.IfThenElse.parse_ifthenelse",
"LowParse.Spec.IfThenElse.serialize_ifthenelse"
] | [] | module LowParse.SLow.IfThenElse
include LowParse.Spec.IfThenElse
include LowParse.SLow.Combinators
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
inline_for_extraction
let parse32_ifthenelse
(p: parse_ifthenelse_param)
(pt32: parser32 p.parse_ifthenelse_tag_parser)
(b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))
(pp32: (b: bool) -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b))))
(synt: (b: bool) -> (t: p.parse_ifthenelse_tag_t { b == p.parse_ifthenelse_tag_cond t } ) -> (pl: p.parse_ifthenelse_payload_t b) -> Tot (y: p.parse_ifthenelse_t { y == p.parse_ifthenelse_synth t pl } ))
: Tot (parser32 (parse_ifthenelse p))
= fun input ->
((
[@inline_let]
let _ = parse_ifthenelse_eq p (B32.reveal input) in
match pt32 input with
| None -> None
| Some (t, consumed_t) ->
let b = b32 t in
let input' = B32.slice input consumed_t (B32.len input) in
if b
then
match pp32 true input' with
| None -> None
| Some (pl, consumed_pl) ->
Some (synt true t pl, consumed_t `U32.add` consumed_pl)
else
match pp32 false input' with
| None -> None
| Some (pl, consumed_pl) ->
Some (synt false t pl, consumed_t `U32.add` consumed_pl)
) <: (res: _ { parser32_correct (parse_ifthenelse p) input res } )
)
inline_for_extraction
let serialize32_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p {
let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\
Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high < 4294967296 /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high < 4294967296
})
(st32: serializer32 s.serialize_ifthenelse_tag_serializer)
(syntt: (x: p.parse_ifthenelse_t) -> Tot (t: p.parse_ifthenelse_tag_t { t == dfst (s.serialize_ifthenelse_synth_recip x) } ))
(b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))
(syntp: (b: bool) -> (x: p.parse_ifthenelse_t { b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x)) } ) -> Tot (pl: p.parse_ifthenelse_payload_t b { pl == dsnd (s.serialize_ifthenelse_synth_recip x) } ))
(sp32: (b: bool) -> Tot (serializer32 (s.serialize_ifthenelse_payload_serializer b))) | false | false | LowParse.SLow.IfThenElse.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val serialize32_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{ let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\ Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <
4294967296 /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <
4294967296 })
(st32: serializer32 s.serialize_ifthenelse_tag_serializer)
(syntt:
(x: p.parse_ifthenelse_t
-> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})
))
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(syntp:
(
b: bool ->
x:
p.parse_ifthenelse_t
{b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}
-> Tot
(pl:
p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}
)))
(sp32: (b: bool -> Tot (serializer32 (s.serialize_ifthenelse_payload_serializer b))))
: Tot (serializer32 (serialize_ifthenelse s)) | [] | LowParse.SLow.IfThenElse.serialize32_ifthenelse | {
"file_name": "src/lowparse/LowParse.SLow.IfThenElse.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
s:
LowParse.Spec.IfThenElse.serialize_ifthenelse_param p
{ let tk = Mkparse_ifthenelse_param?.parse_ifthenelse_tag_kind p in
Mkparser_kind'?.parser_kind_subkind tk ==
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\
Some? (Mkparser_kind'?.parser_kind_high tk) /\
Some? (Mkparser_kind'?.parser_kind_high (FStar.Pervasives.dfst (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
true))) /\
Some? (Mkparser_kind'?.parser_kind_high (FStar.Pervasives.dfst (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
false))) /\
Some?.v (Mkparser_kind'?.parser_kind_high tk) +
Some?.v (Mkparser_kind'?.parser_kind_high (FStar.Pervasives.dfst (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
true))) <
4294967296 /\
Some?.v (Mkparser_kind'?.parser_kind_high tk) +
Some?.v (Mkparser_kind'?.parser_kind_high (FStar.Pervasives.dfst (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
false))) <
4294967296 } ->
st32:
LowParse.SLow.Base.serializer32 (Mkserialize_ifthenelse_param?.serialize_ifthenelse_tag_serializer
s) ->
syntt:
(x: Mkparse_ifthenelse_param?.parse_ifthenelse_t p
-> t:
Mkparse_ifthenelse_param?.parse_ifthenelse_tag_t p
{ t ==
FStar.Pervasives.dfst (Mkserialize_ifthenelse_param?.serialize_ifthenelse_synth_recip
s
x) }) ->
b32:
(t: Mkparse_ifthenelse_param?.parse_ifthenelse_tag_t p
-> b: Prims.bool{b == Mkparse_ifthenelse_param?.parse_ifthenelse_tag_cond p t}) ->
syntp:
(
b: Prims.bool ->
x:
Mkparse_ifthenelse_param?.parse_ifthenelse_t p
{ b ==
Mkparse_ifthenelse_param?.parse_ifthenelse_tag_cond p
(FStar.Pervasives.dfst (Mkserialize_ifthenelse_param?.serialize_ifthenelse_synth_recip
s
x)) }
-> pl:
Mkparse_ifthenelse_param?.parse_ifthenelse_payload_t p b
{ pl ==
FStar.Pervasives.dsnd (Mkserialize_ifthenelse_param?.serialize_ifthenelse_synth_recip
s
x) }) ->
sp32:
(b: Prims.bool
-> LowParse.SLow.Base.serializer32 (Mkserialize_ifthenelse_param?.serialize_ifthenelse_payload_serializer
s
b))
-> LowParse.SLow.Base.serializer32 (LowParse.Spec.IfThenElse.serialize_ifthenelse s) | {
"end_col": 76,
"end_line": 68,
"start_col": 2,
"start_line": 57
} |
Prims.Tot | val size32_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{ let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\ Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <
4294967296 /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <
4294967296 })
(st32: size32 s.serialize_ifthenelse_tag_serializer)
(syntt:
(x: p.parse_ifthenelse_t
-> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})
))
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(syntp:
(
b: bool ->
x:
p.parse_ifthenelse_t
{b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}
-> Tot
(pl:
p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}
)))
(sp32: (b: bool -> Tot (size32 (s.serialize_ifthenelse_payload_serializer b))))
: Tot (size32 (serialize_ifthenelse s)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.SLow.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.IfThenElse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let size32_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p {
let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\
Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high < 4294967296 /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high < 4294967296
})
(st32: size32 s.serialize_ifthenelse_tag_serializer)
(syntt: (x: p.parse_ifthenelse_t) -> Tot (t: p.parse_ifthenelse_tag_t { t == dfst (s.serialize_ifthenelse_synth_recip x) } ))
(b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))
(syntp: (b: bool) -> (x: p.parse_ifthenelse_t { b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x)) } ) -> Tot (pl: p.parse_ifthenelse_payload_t b { pl == dsnd (s.serialize_ifthenelse_synth_recip x) } ))
(sp32: (b: bool) -> Tot (size32 (s.serialize_ifthenelse_payload_serializer b)))
: Tot (size32 (serialize_ifthenelse s))
= fun (input: p.parse_ifthenelse_t) -> ((
let t = syntt input in
let st = st32 t in
let b = b32 t in
if b
then
let y = syntp true input in
U32.add st (sp32 true y)
else
let y = syntp false input in
U32.add st (sp32 false y)
) <: (res: _ { size32_postcond (serialize_ifthenelse s) input res })) | val size32_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{ let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\ Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <
4294967296 /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <
4294967296 })
(st32: size32 s.serialize_ifthenelse_tag_serializer)
(syntt:
(x: p.parse_ifthenelse_t
-> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})
))
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(syntp:
(
b: bool ->
x:
p.parse_ifthenelse_t
{b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}
-> Tot
(pl:
p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}
)))
(sp32: (b: bool -> Tot (size32 (s.serialize_ifthenelse_payload_serializer b))))
: Tot (size32 (serialize_ifthenelse s))
let size32_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{ let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\ Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <
4294967296 /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <
4294967296 })
(st32: size32 s.serialize_ifthenelse_tag_serializer)
(syntt:
(x: p.parse_ifthenelse_t
-> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})
))
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(syntp:
(
b: bool ->
x:
p.parse_ifthenelse_t
{b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}
-> Tot
(pl:
p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}
)))
(sp32: (b: bool -> Tot (size32 (s.serialize_ifthenelse_payload_serializer b))))
: Tot (size32 (serialize_ifthenelse s)) = | false | null | false | fun (input: p.parse_ifthenelse_t) ->
((let t = syntt input in
let st = st32 t in
let b = b32 t in
if b
then
let y = syntp true input in
U32.add st (sp32 true y)
else
let y = syntp false input in
U32.add st (sp32 false y))
<:
(res: _{size32_postcond (serialize_ifthenelse s) input res})) | {
"checked_file": "LowParse.SLow.IfThenElse.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.IfThenElse.fst.checked",
"LowParse.SLow.Combinators.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.IfThenElse.fst"
} | [
"total"
] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.IfThenElse.serialize_ifthenelse_param",
"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",
"FStar.Pervasives.Native.uu___is_Some",
"Prims.nat",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high",
"FStar.Pervasives.dfst",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser",
"Prims.op_LessThan",
"Prims.op_Addition",
"FStar.Pervasives.Native.__proj__Some__item__v",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_kind",
"LowParse.SLow.Base.size32",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_parser",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_tag_serializer",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_synth_recip",
"Prims.bool",
"FStar.Pervasives.dsnd",
"Prims.__proj__Mkdtuple2__item___1",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_payload_serializer",
"FStar.UInt32.add",
"FStar.UInt32.t",
"LowParse.SLow.Base.size32_postcond",
"LowParse.Spec.IfThenElse.parse_ifthenelse_kind",
"LowParse.Spec.IfThenElse.parse_ifthenelse",
"LowParse.Spec.IfThenElse.serialize_ifthenelse"
] | [] | module LowParse.SLow.IfThenElse
include LowParse.Spec.IfThenElse
include LowParse.SLow.Combinators
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
inline_for_extraction
let parse32_ifthenelse
(p: parse_ifthenelse_param)
(pt32: parser32 p.parse_ifthenelse_tag_parser)
(b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))
(pp32: (b: bool) -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b))))
(synt: (b: bool) -> (t: p.parse_ifthenelse_tag_t { b == p.parse_ifthenelse_tag_cond t } ) -> (pl: p.parse_ifthenelse_payload_t b) -> Tot (y: p.parse_ifthenelse_t { y == p.parse_ifthenelse_synth t pl } ))
: Tot (parser32 (parse_ifthenelse p))
= fun input ->
((
[@inline_let]
let _ = parse_ifthenelse_eq p (B32.reveal input) in
match pt32 input with
| None -> None
| Some (t, consumed_t) ->
let b = b32 t in
let input' = B32.slice input consumed_t (B32.len input) in
if b
then
match pp32 true input' with
| None -> None
| Some (pl, consumed_pl) ->
Some (synt true t pl, consumed_t `U32.add` consumed_pl)
else
match pp32 false input' with
| None -> None
| Some (pl, consumed_pl) ->
Some (synt false t pl, consumed_t `U32.add` consumed_pl)
) <: (res: _ { parser32_correct (parse_ifthenelse p) input res } )
)
inline_for_extraction
let serialize32_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p {
let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\
Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high < 4294967296 /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high < 4294967296
})
(st32: serializer32 s.serialize_ifthenelse_tag_serializer)
(syntt: (x: p.parse_ifthenelse_t) -> Tot (t: p.parse_ifthenelse_tag_t { t == dfst (s.serialize_ifthenelse_synth_recip x) } ))
(b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))
(syntp: (b: bool) -> (x: p.parse_ifthenelse_t { b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x)) } ) -> Tot (pl: p.parse_ifthenelse_payload_t b { pl == dsnd (s.serialize_ifthenelse_synth_recip x) } ))
(sp32: (b: bool) -> Tot (serializer32 (s.serialize_ifthenelse_payload_serializer b)))
: Tot (serializer32 (serialize_ifthenelse s))
= fun (input: p.parse_ifthenelse_t) -> ((
let t = syntt input in
let st = st32 t in
let b = b32 t in
if b
then
let y = syntp true input in
B32.append st (sp32 true y)
else
let y = syntp false input in
B32.append st (sp32 false y)
) <: (res: _ { serializer32_correct (serialize_ifthenelse s) input res }))
inline_for_extraction
let size32_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p {
let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\
Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high < 4294967296 /\
Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high < 4294967296
})
(st32: size32 s.serialize_ifthenelse_tag_serializer)
(syntt: (x: p.parse_ifthenelse_t) -> Tot (t: p.parse_ifthenelse_tag_t { t == dfst (s.serialize_ifthenelse_synth_recip x) } ))
(b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))
(syntp: (b: bool) -> (x: p.parse_ifthenelse_t { b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x)) } ) -> Tot (pl: p.parse_ifthenelse_payload_t b { pl == dsnd (s.serialize_ifthenelse_synth_recip x) } ))
(sp32: (b: bool) -> Tot (size32 (s.serialize_ifthenelse_payload_serializer b))) | false | false | LowParse.SLow.IfThenElse.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val size32_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{ let tk = p.parse_ifthenelse_tag_kind in
tk.parser_kind_subkind == Some ParserStrong /\ Some? tk.parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\
Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <
4294967296 /\
Some?.v tk.parser_kind_high +
Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <
4294967296 })
(st32: size32 s.serialize_ifthenelse_tag_serializer)
(syntt:
(x: p.parse_ifthenelse_t
-> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})
))
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(syntp:
(
b: bool ->
x:
p.parse_ifthenelse_t
{b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}
-> Tot
(pl:
p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}
)))
(sp32: (b: bool -> Tot (size32 (s.serialize_ifthenelse_payload_serializer b))))
: Tot (size32 (serialize_ifthenelse s)) | [] | LowParse.SLow.IfThenElse.size32_ifthenelse | {
"file_name": "src/lowparse/LowParse.SLow.IfThenElse.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
s:
LowParse.Spec.IfThenElse.serialize_ifthenelse_param p
{ let tk = Mkparse_ifthenelse_param?.parse_ifthenelse_tag_kind p in
Mkparser_kind'?.parser_kind_subkind tk ==
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\
Some? (Mkparser_kind'?.parser_kind_high tk) /\
Some? (Mkparser_kind'?.parser_kind_high (FStar.Pervasives.dfst (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
true))) /\
Some? (Mkparser_kind'?.parser_kind_high (FStar.Pervasives.dfst (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
false))) /\
Some?.v (Mkparser_kind'?.parser_kind_high tk) +
Some?.v (Mkparser_kind'?.parser_kind_high (FStar.Pervasives.dfst (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
true))) <
4294967296 /\
Some?.v (Mkparser_kind'?.parser_kind_high tk) +
Some?.v (Mkparser_kind'?.parser_kind_high (FStar.Pervasives.dfst (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
false))) <
4294967296 } ->
st32:
LowParse.SLow.Base.size32 (Mkserialize_ifthenelse_param?.serialize_ifthenelse_tag_serializer s
) ->
syntt:
(x: Mkparse_ifthenelse_param?.parse_ifthenelse_t p
-> t:
Mkparse_ifthenelse_param?.parse_ifthenelse_tag_t p
{ t ==
FStar.Pervasives.dfst (Mkserialize_ifthenelse_param?.serialize_ifthenelse_synth_recip
s
x) }) ->
b32:
(t: Mkparse_ifthenelse_param?.parse_ifthenelse_tag_t p
-> b: Prims.bool{b == Mkparse_ifthenelse_param?.parse_ifthenelse_tag_cond p t}) ->
syntp:
(
b: Prims.bool ->
x:
Mkparse_ifthenelse_param?.parse_ifthenelse_t p
{ b ==
Mkparse_ifthenelse_param?.parse_ifthenelse_tag_cond p
(FStar.Pervasives.dfst (Mkserialize_ifthenelse_param?.serialize_ifthenelse_synth_recip
s
x)) }
-> pl:
Mkparse_ifthenelse_param?.parse_ifthenelse_payload_t p b
{ pl ==
FStar.Pervasives.dsnd (Mkserialize_ifthenelse_param?.serialize_ifthenelse_synth_recip
s
x) }) ->
sp32:
(b: Prims.bool
-> LowParse.SLow.Base.size32 (Mkserialize_ifthenelse_param?.serialize_ifthenelse_payload_serializer
s
b))
-> LowParse.SLow.Base.size32 (LowParse.Spec.IfThenElse.serialize_ifthenelse s) | {
"end_col": 71,
"end_line": 99,
"start_col": 2,
"start_line": 88
} |
Prims.Tot | val parse32_ifthenelse
(p: parse_ifthenelse_param)
(pt32: parser32 p.parse_ifthenelse_tag_parser)
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(pp32: (b: bool -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b)))))
(synt:
(
b: bool ->
t: p.parse_ifthenelse_tag_t{b == p.parse_ifthenelse_tag_cond t} ->
pl: p.parse_ifthenelse_payload_t b
-> Tot (y: p.parse_ifthenelse_t{y == p.parse_ifthenelse_synth t pl})))
: Tot (parser32 (parse_ifthenelse p)) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.Bytes32",
"short_module": "B32"
},
{
"abbrev": false,
"full_module": "LowParse.SLow.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.IfThenElse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse32_ifthenelse
(p: parse_ifthenelse_param)
(pt32: parser32 p.parse_ifthenelse_tag_parser)
(b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))
(pp32: (b: bool) -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b))))
(synt: (b: bool) -> (t: p.parse_ifthenelse_tag_t { b == p.parse_ifthenelse_tag_cond t } ) -> (pl: p.parse_ifthenelse_payload_t b) -> Tot (y: p.parse_ifthenelse_t { y == p.parse_ifthenelse_synth t pl } ))
: Tot (parser32 (parse_ifthenelse p))
= fun input ->
((
[@inline_let]
let _ = parse_ifthenelse_eq p (B32.reveal input) in
match pt32 input with
| None -> None
| Some (t, consumed_t) ->
let b = b32 t in
let input' = B32.slice input consumed_t (B32.len input) in
if b
then
match pp32 true input' with
| None -> None
| Some (pl, consumed_pl) ->
Some (synt true t pl, consumed_t `U32.add` consumed_pl)
else
match pp32 false input' with
| None -> None
| Some (pl, consumed_pl) ->
Some (synt false t pl, consumed_t `U32.add` consumed_pl)
) <: (res: _ { parser32_correct (parse_ifthenelse p) input res } )
) | val parse32_ifthenelse
(p: parse_ifthenelse_param)
(pt32: parser32 p.parse_ifthenelse_tag_parser)
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(pp32: (b: bool -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b)))))
(synt:
(
b: bool ->
t: p.parse_ifthenelse_tag_t{b == p.parse_ifthenelse_tag_cond t} ->
pl: p.parse_ifthenelse_payload_t b
-> Tot (y: p.parse_ifthenelse_t{y == p.parse_ifthenelse_synth t pl})))
: Tot (parser32 (parse_ifthenelse p))
let parse32_ifthenelse
(p: parse_ifthenelse_param)
(pt32: parser32 p.parse_ifthenelse_tag_parser)
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(pp32: (b: bool -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b)))))
(synt:
(
b: bool ->
t: p.parse_ifthenelse_tag_t{b == p.parse_ifthenelse_tag_cond t} ->
pl: p.parse_ifthenelse_payload_t b
-> Tot (y: p.parse_ifthenelse_t{y == p.parse_ifthenelse_synth t pl})))
: Tot (parser32 (parse_ifthenelse p)) = | false | null | false | fun input ->
(([@@ inline_let ]let _ = parse_ifthenelse_eq p (B32.reveal input) in
match pt32 input with
| None -> None
| Some (t, consumed_t) ->
let b = b32 t in
let input' = B32.slice input consumed_t (B32.len input) in
if b
then
match pp32 true input' with
| None -> None
| Some (pl, consumed_pl) -> Some (synt true t pl, consumed_t `U32.add` consumed_pl)
else
match pp32 false input' with
| None -> None
| Some (pl, consumed_pl) -> Some (synt false t pl, consumed_t `U32.add` consumed_pl))
<:
(res: _{parser32_correct (parse_ifthenelse p) input res})) | {
"checked_file": "LowParse.SLow.IfThenElse.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.IfThenElse.fst.checked",
"LowParse.SLow.Combinators.fst.checked",
"LowParse.Bytes32.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.IfThenElse.fst"
} | [
"total"
] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.SLow.Base.parser32",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_kind",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_parser",
"Prims.bool",
"Prims.eq2",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"Prims.__proj__Mkdtuple2__item___1",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser",
"FStar.Pervasives.dsnd",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_synth",
"LowParse.SLow.Base.bytes32",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.tuple2",
"FStar.UInt32.t",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"FStar.UInt32.add",
"FStar.Pervasives.Native.option",
"LowParse.SLow.Base.parser32_correct",
"LowParse.Spec.IfThenElse.parse_ifthenelse_kind",
"LowParse.Spec.IfThenElse.parse_ifthenelse",
"FStar.Bytes.bytes",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"FStar.Bytes.reveal",
"FStar.Seq.Base.slice",
"FStar.UInt32.v",
"FStar.Bytes.len",
"FStar.Bytes.slice",
"Prims.unit",
"LowParse.Spec.IfThenElse.parse_ifthenelse_eq"
] | [] | module LowParse.SLow.IfThenElse
include LowParse.Spec.IfThenElse
include LowParse.SLow.Combinators
module B32 = LowParse.Bytes32
module U32 = FStar.UInt32
inline_for_extraction
let parse32_ifthenelse
(p: parse_ifthenelse_param)
(pt32: parser32 p.parse_ifthenelse_tag_parser)
(b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))
(pp32: (b: bool) -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b))))
(synt: (b: bool) -> (t: p.parse_ifthenelse_tag_t { b == p.parse_ifthenelse_tag_cond t } ) -> (pl: p.parse_ifthenelse_payload_t b) -> Tot (y: p.parse_ifthenelse_t { y == p.parse_ifthenelse_synth t pl } )) | false | false | LowParse.SLow.IfThenElse.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val parse32_ifthenelse
(p: parse_ifthenelse_param)
(pt32: parser32 p.parse_ifthenelse_tag_parser)
(b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))
(pp32: (b: bool -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b)))))
(synt:
(
b: bool ->
t: p.parse_ifthenelse_tag_t{b == p.parse_ifthenelse_tag_cond t} ->
pl: p.parse_ifthenelse_payload_t b
-> Tot (y: p.parse_ifthenelse_t{y == p.parse_ifthenelse_synth t pl})))
: Tot (parser32 (parse_ifthenelse p)) | [] | LowParse.SLow.IfThenElse.parse32_ifthenelse | {
"file_name": "src/lowparse/LowParse.SLow.IfThenElse.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
p: LowParse.Spec.IfThenElse.parse_ifthenelse_param ->
pt32: LowParse.SLow.Base.parser32 (Mkparse_ifthenelse_param?.parse_ifthenelse_tag_parser p) ->
b32:
(t: Mkparse_ifthenelse_param?.parse_ifthenelse_tag_t p
-> b: Prims.bool{b == Mkparse_ifthenelse_param?.parse_ifthenelse_tag_cond p t}) ->
pp32:
(b: Prims.bool
-> LowParse.SLow.Base.parser32 (FStar.Pervasives.dsnd (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
b))) ->
synt:
(
b: Prims.bool ->
t:
Mkparse_ifthenelse_param?.parse_ifthenelse_tag_t p
{b == Mkparse_ifthenelse_param?.parse_ifthenelse_tag_cond p t} ->
pl: Mkparse_ifthenelse_param?.parse_ifthenelse_payload_t p b
-> y:
Mkparse_ifthenelse_param?.parse_ifthenelse_t p
{y == Mkparse_ifthenelse_param?.parse_ifthenelse_synth p t pl})
-> LowParse.SLow.Base.parser32 (LowParse.Spec.IfThenElse.parse_ifthenelse p) | {
"end_col": 3,
"end_line": 37,
"start_col": 2,
"start_line": 16
} |
Prims.Tot | val init_func_from_expr
(#c: _)
(#n0: int)
(#nk: not_less_than n0)
(expr: ((ifrom_ito n0 nk) -> c))
(a: ifrom_ito n0 nk)
(b: ifrom_ito a nk)
: (counter_for (ifrom_ito a b) -> c) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Permutation",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Algebra.CommMonoid",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let init_func_from_expr #c (#n0: int) (#nk: not_less_than n0)
(expr: (ifrom_ito n0 nk) -> c)
(a: ifrom_ito n0 nk) (b: ifrom_ito a nk)
: (counter_for (ifrom_ito a b) -> c)
= fun (i: counter_for (ifrom_ito a b)) -> expr (n0 + i) | val init_func_from_expr
(#c: _)
(#n0: int)
(#nk: not_less_than n0)
(expr: ((ifrom_ito n0 nk) -> c))
(a: ifrom_ito n0 nk)
(b: ifrom_ito a nk)
: (counter_for (ifrom_ito a b) -> c)
let init_func_from_expr
#c
(#n0: int)
(#nk: not_less_than n0)
(expr: ((ifrom_ito n0 nk) -> c))
(a: ifrom_ito n0 nk)
(b: ifrom_ito a nk)
: (counter_for (ifrom_ito a b) -> c) = | false | null | false | fun (i: counter_for (ifrom_ito a b)) -> expr (n0 + i) | {
"checked_file": "FStar.Algebra.CommMonoid.Fold.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Permutation.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Algebra.CommMonoid.Fold.fsti"
} | [
"total"
] | [
"Prims.int",
"FStar.IntegerIntervals.not_less_than",
"FStar.IntegerIntervals.ifrom_ito",
"FStar.IntegerIntervals.counter_for",
"Prims.op_Addition"
] | [] | (*
Copyright 2008-2022 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.
Author: A. Rozanov
*)
module FStar.Algebra.CommMonoid.Fold
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.Seq.Permutation
open FStar.IntegerIntervals
open FStar.Mul
(* Here we define the notion for big sums and big products for
arbitrary commutative monoids. We construct the folds from
an integer range and a function, then calculate the fold --
a sum or a product, depending on the monoid operation. *)
(* We refine multiplication a bit to make proofs smoothier *)
(* Notice how we can't just use a and b if we don't want to break
recursive calls with the same exprs *)
let init_func_from_expr #c (#n0: int) (#nk: not_less_than n0)
(expr: (ifrom_ito n0 nk) -> c)
(a: ifrom_ito n0 nk) (b: ifrom_ito a nk) | false | false | FStar.Algebra.CommMonoid.Fold.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val init_func_from_expr
(#c: _)
(#n0: int)
(#nk: not_less_than n0)
(expr: ((ifrom_ito n0 nk) -> c))
(a: ifrom_ito n0 nk)
(b: ifrom_ito a nk)
: (counter_for (ifrom_ito a b) -> c) | [] | FStar.Algebra.CommMonoid.Fold.init_func_from_expr | {
"file_name": "ulib/FStar.Algebra.CommMonoid.Fold.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} |
expr: (_: FStar.IntegerIntervals.ifrom_ito n0 nk -> c) ->
a: FStar.IntegerIntervals.ifrom_ito n0 nk ->
b: FStar.IntegerIntervals.ifrom_ito a nk ->
_: FStar.IntegerIntervals.counter_for (FStar.IntegerIntervals.ifrom_ito a b)
-> c | {
"end_col": 57,
"end_line": 44,
"start_col": 4,
"start_line": 44
} |
FStar.Pervasives.Lemma | val transpose4_lemma: k:state 4 -> i:nat{i < 16 * 4} ->
Lemma ((vec_v (transpose4 k).[i / 4]).[i % 4] == ((transpose_state k).[i / 16]).[i % 16]) | [
{
"abbrev": false,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector.Transpose",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let transpose4_lemma st i =
let r0 = transpose4x4_lseq (sub st 0 4) in
transpose4x4_lemma (sub st 0 4);
let r1 = transpose4x4_lseq (sub st 4 4) in
transpose4x4_lemma (sub st 4 4);
let r2 = transpose4x4_lseq (sub st 8 4) in
transpose4x4_lemma (sub st 8 4);
let r3 = transpose4x4_lseq (sub st 12 4) in
transpose4x4_lemma (sub st 12 4) | val transpose4_lemma: k:state 4 -> i:nat{i < 16 * 4} ->
Lemma ((vec_v (transpose4 k).[i / 4]).[i % 4] == ((transpose_state k).[i / 16]).[i % 16])
let transpose4_lemma st i = | false | null | true | let r0 = transpose4x4_lseq (sub st 0 4) in
transpose4x4_lemma (sub st 0 4);
let r1 = transpose4x4_lseq (sub st 4 4) in
transpose4x4_lemma (sub st 4 4);
let r2 = transpose4x4_lseq (sub st 8 4) in
transpose4x4_lemma (sub st 8 4);
let r3 = transpose4x4_lseq (sub st 12 4) in
transpose4x4_lemma (sub st 12 4) | {
"checked_file": "Hacl.Spec.Chacha20.Lemmas.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntVector.Transpose.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Chacha20.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Chacha20.Vec.state",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Mul.op_Star",
"Lib.IntVector.Transpose.transpose4x4_lemma",
"Lib.IntTypes.U32",
"Lib.Sequence.sub",
"Hacl.Spec.Chacha20.Vec.uint32xN",
"Lib.Sequence.lseq",
"Lib.IntVector.vec_t",
"Lib.IntVector.Transpose.transpose4x4_lseq",
"Prims.unit"
] | [] | module Hacl.Spec.Chacha20.Lemmas
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.IntVector
open Lib.IntVector.Transpose
open Hacl.Spec.Chacha20.Vec
#set-options "--z3rlimit 50 --fuel 0 --ifuel 1"
/// (vec_v (transpose #w k).[i / w]).[i % w] == ((transpose_state k).[i / 16]).[i % 16]
val transpose4_lemma: k:state 4 -> i:nat{i < 16 * 4} -> | false | false | Hacl.Spec.Chacha20.Lemmas.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val transpose4_lemma: k:state 4 -> i:nat{i < 16 * 4} ->
Lemma ((vec_v (transpose4 k).[i / 4]).[i % 4] == ((transpose_state k).[i / 16]).[i % 16]) | [] | Hacl.Spec.Chacha20.Lemmas.transpose4_lemma | {
"file_name": "code/chacha20/Hacl.Spec.Chacha20.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Hacl.Spec.Chacha20.Vec.state 4 -> i: Prims.nat{i < 16 * 4}
-> FStar.Pervasives.Lemma
(ensures
(Lib.IntVector.vec_v (Hacl.Spec.Chacha20.Vec.transpose4 k).[ i / 4 ]).[ i % 4 ] ==
(Hacl.Spec.Chacha20.Vec.transpose_state k).[ i / 16 ].[ i % 16 ]) | {
"end_col": 34,
"end_line": 25,
"start_col": 27,
"start_line": 17
} |
FStar.Pervasives.Lemma | val transpose_lemma_index: #w:lanes -> k:state w -> i:nat{i < 16 * w} ->
Lemma ((vec_v (transpose #w k).[i / w]).[i % w] == ((transpose_state k).[i / 16]).[i % 16]) | [
{
"abbrev": false,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector.Transpose",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let transpose_lemma_index #w k i =
match w with
| 1 -> ()
| 4 -> transpose4_lemma k i
| 8 -> transpose8_lemma k i | val transpose_lemma_index: #w:lanes -> k:state w -> i:nat{i < 16 * w} ->
Lemma ((vec_v (transpose #w k).[i / w]).[i % w] == ((transpose_state k).[i / 16]).[i % 16])
let transpose_lemma_index #w k i = | false | null | true | match w with
| 1 -> ()
| 4 -> transpose4_lemma k i
| 8 -> transpose8_lemma k i | {
"checked_file": "Hacl.Spec.Chacha20.Lemmas.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntVector.Transpose.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Chacha20.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Chacha20.Vec.lanes",
"Hacl.Spec.Chacha20.Vec.state",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Mul.op_Star",
"Hacl.Spec.Chacha20.Lemmas.transpose4_lemma",
"Hacl.Spec.Chacha20.Lemmas.transpose8_lemma",
"Prims.unit"
] | [] | module Hacl.Spec.Chacha20.Lemmas
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.IntVector
open Lib.IntVector.Transpose
open Hacl.Spec.Chacha20.Vec
#set-options "--z3rlimit 50 --fuel 0 --ifuel 1"
/// (vec_v (transpose #w k).[i / w]).[i % w] == ((transpose_state k).[i / 16]).[i % 16]
val transpose4_lemma: k:state 4 -> i:nat{i < 16 * 4} ->
Lemma ((vec_v (transpose4 k).[i / 4]).[i % 4] == ((transpose_state k).[i / 16]).[i % 16])
let transpose4_lemma st i =
let r0 = transpose4x4_lseq (sub st 0 4) in
transpose4x4_lemma (sub st 0 4);
let r1 = transpose4x4_lseq (sub st 4 4) in
transpose4x4_lemma (sub st 4 4);
let r2 = transpose4x4_lseq (sub st 8 4) in
transpose4x4_lemma (sub st 8 4);
let r3 = transpose4x4_lseq (sub st 12 4) in
transpose4x4_lemma (sub st 12 4)
val transpose8_lemma: k:state 8 -> i:nat{i < 16 * 8} ->
Lemma ((vec_v (transpose8 k).[i / 8]).[i % 8] == ((transpose_state k).[i / 16]).[i % 16])
let transpose8_lemma st i =
let r0 = transpose8x8_lseq (sub st 0 8) in
transpose8x8_lemma (sub st 0 8);
let r1 = transpose8x8_lseq (sub st 8 8) in
transpose8x8_lemma (sub st 8 8)
val transpose_lemma_index: #w:lanes -> k:state w -> i:nat{i < 16 * w} ->
Lemma ((vec_v (transpose #w k).[i / w]).[i % w] == ((transpose_state k).[i / 16]).[i % 16]) | false | false | Hacl.Spec.Chacha20.Lemmas.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val transpose_lemma_index: #w:lanes -> k:state w -> i:nat{i < 16 * w} ->
Lemma ((vec_v (transpose #w k).[i / w]).[i % w] == ((transpose_state k).[i / 16]).[i % 16]) | [] | Hacl.Spec.Chacha20.Lemmas.transpose_lemma_index | {
"file_name": "code/chacha20/Hacl.Spec.Chacha20.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Hacl.Spec.Chacha20.Vec.state w -> i: Prims.nat{i < 16 * w}
-> FStar.Pervasives.Lemma
(ensures
(Lib.IntVector.vec_v (Hacl.Spec.Chacha20.Vec.transpose k).[ i / w ]).[ i % w ] ==
(Hacl.Spec.Chacha20.Vec.transpose_state k).[ i / 16 ].[ i % 16 ]) | {
"end_col": 29,
"end_line": 43,
"start_col": 2,
"start_line": 40
} |
FStar.Pervasives.Lemma | val transpose8_lemma: k:state 8 -> i:nat{i < 16 * 8} ->
Lemma ((vec_v (transpose8 k).[i / 8]).[i % 8] == ((transpose_state k).[i / 16]).[i % 16]) | [
{
"abbrev": false,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector.Transpose",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let transpose8_lemma st i =
let r0 = transpose8x8_lseq (sub st 0 8) in
transpose8x8_lemma (sub st 0 8);
let r1 = transpose8x8_lseq (sub st 8 8) in
transpose8x8_lemma (sub st 8 8) | val transpose8_lemma: k:state 8 -> i:nat{i < 16 * 8} ->
Lemma ((vec_v (transpose8 k).[i / 8]).[i % 8] == ((transpose_state k).[i / 16]).[i % 16])
let transpose8_lemma st i = | false | null | true | let r0 = transpose8x8_lseq (sub st 0 8) in
transpose8x8_lemma (sub st 0 8);
let r1 = transpose8x8_lseq (sub st 8 8) in
transpose8x8_lemma (sub st 8 8) | {
"checked_file": "Hacl.Spec.Chacha20.Lemmas.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntVector.Transpose.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Chacha20.Lemmas.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Chacha20.Vec.state",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Mul.op_Star",
"Lib.IntVector.Transpose.transpose8x8_lemma",
"Lib.IntTypes.U32",
"Lib.Sequence.sub",
"Hacl.Spec.Chacha20.Vec.uint32xN",
"Lib.Sequence.lseq",
"Lib.IntVector.vec_t",
"Lib.IntVector.Transpose.transpose8x8_lseq",
"Prims.unit"
] | [] | module Hacl.Spec.Chacha20.Lemmas
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.IntVector
open Lib.IntVector.Transpose
open Hacl.Spec.Chacha20.Vec
#set-options "--z3rlimit 50 --fuel 0 --ifuel 1"
/// (vec_v (transpose #w k).[i / w]).[i % w] == ((transpose_state k).[i / 16]).[i % 16]
val transpose4_lemma: k:state 4 -> i:nat{i < 16 * 4} ->
Lemma ((vec_v (transpose4 k).[i / 4]).[i % 4] == ((transpose_state k).[i / 16]).[i % 16])
let transpose4_lemma st i =
let r0 = transpose4x4_lseq (sub st 0 4) in
transpose4x4_lemma (sub st 0 4);
let r1 = transpose4x4_lseq (sub st 4 4) in
transpose4x4_lemma (sub st 4 4);
let r2 = transpose4x4_lseq (sub st 8 4) in
transpose4x4_lemma (sub st 8 4);
let r3 = transpose4x4_lseq (sub st 12 4) in
transpose4x4_lemma (sub st 12 4)
val transpose8_lemma: k:state 8 -> i:nat{i < 16 * 8} -> | false | false | Hacl.Spec.Chacha20.Lemmas.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val transpose8_lemma: k:state 8 -> i:nat{i < 16 * 8} ->
Lemma ((vec_v (transpose8 k).[i / 8]).[i % 8] == ((transpose_state k).[i / 16]).[i % 16]) | [] | Hacl.Spec.Chacha20.Lemmas.transpose8_lemma | {
"file_name": "code/chacha20/Hacl.Spec.Chacha20.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Hacl.Spec.Chacha20.Vec.state 8 -> i: Prims.nat{i < 16 * 8}
-> FStar.Pervasives.Lemma
(ensures
(Lib.IntVector.vec_v (Hacl.Spec.Chacha20.Vec.transpose8 k).[ i / 8 ]).[ i % 8 ] ==
(Hacl.Spec.Chacha20.Vec.transpose_state k).[ i / 16 ].[ i % 16 ]) | {
"end_col": 33,
"end_line": 34,
"start_col": 27,
"start_line": 30
} |
Prims.Tot | val der_length_max:nat | [
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255 | val der_length_max:nat
let der_length_max:nat = | false | null | false | 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255 | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0" | false | true | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val der_length_max:nat | [] | LowParse.Spec.DER.der_length_max | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | Prims.nat | {
"end_col": 331,
"end_line": 15,
"start_col": 27,
"start_line": 15
} |
Prims.Tot | val der_length_payload_size (x: der_length_t) : Tot (y: nat{y <= 126}) | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let der_length_payload_size
(x: der_length_t)
: Tot (y: nat { y <= 126 })
= der_length_payload_size_of_tag (tag_of_der_length x) | val der_length_payload_size (x: der_length_t) : Tot (y: nat{y <= 126})
let der_length_payload_size (x: der_length_t) : Tot (y: nat{y <= 126}) = | false | null | false | der_length_payload_size_of_tag (tag_of_der_length x) | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"LowParse.Spec.DER.der_length_t",
"LowParse.Spec.DER.der_length_payload_size_of_tag",
"LowParse.Spec.DER.tag_of_der_length",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128
inline_for_extraction
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None
[@@(noextract_to "krml")]
let tag_of_der_length
(x: der_length_t)
: Tot U8.t
= if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` U8.uint_to_t len_len
[@@(noextract_to "krml")]
let der_length_payload_size
(x: der_length_t) | false | false | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val der_length_payload_size (x: der_length_t) : Tot (y: nat{y <= 126}) | [] | LowParse.Spec.DER.der_length_payload_size | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: LowParse.Spec.DER.der_length_t -> y: Prims.nat{y <= 126} | {
"end_col": 54,
"end_line": 86,
"start_col": 2,
"start_line": 86
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let der_length_t = (x: nat { x <= der_length_max }) | let der_length_t = | false | null | false | (x: nat{x <= der_length_max}) | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"LowParse.Spec.DER.der_length_max"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max | false | true | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val der_length_t : Type0 | [] | LowParse.Spec.DER.der_length_t | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | Type0 | {
"end_col": 51,
"end_line": 23,
"start_col": 19,
"start_line": 23
} |
|
Prims.Tot | val parse_der_length_payload_kind (x: U8.t) : Tot parser_kind | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None | val parse_der_length_payload_kind (x: U8.t) : Tot parser_kind
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind = | false | null | false | let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"FStar.UInt8.t",
"LowParse.Spec.Base.strong_parser_kind",
"FStar.Pervasives.Native.None",
"LowParse.Spec.Base.parser_kind_metadata_some",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"LowParse.Spec.DER.der_length_payload_size_of_tag",
"LowParse.Spec.Base.parser_kind"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128 | false | true | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val parse_der_length_payload_kind (x: U8.t) : Tot parser_kind | [] | LowParse.Spec.DER.parse_der_length_payload_kind | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: FStar.UInt8.t -> LowParse.Spec.Base.parser_kind | {
"end_col": 33,
"end_line": 68,
"start_col": 63,
"start_line": 66
} |
Prims.GTot | val tag_of_der_length32 (x: U32.t) : GTot U8.t | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tag_of_der_length32
(x: U32.t)
: GTot U8.t
= let _ = assert_norm (pow2 32 - 1 <= der_length_max) in
tag_of_der_length (U32.v x) | val tag_of_der_length32 (x: U32.t) : GTot U8.t
let tag_of_der_length32 (x: U32.t) : GTot U8.t = | false | null | false | let _ = assert_norm (pow2 32 - 1 <= der_length_max) in
tag_of_der_length (U32.v x) | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"sometrivial"
] | [
"FStar.UInt32.t",
"LowParse.Spec.DER.tag_of_der_length",
"FStar.UInt32.v",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"LowParse.Spec.DER.der_length_max",
"FStar.UInt8.t"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128
inline_for_extraction
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None
[@@(noextract_to "krml")]
let tag_of_der_length
(x: der_length_t)
: Tot U8.t
= if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` U8.uint_to_t len_len
[@@(noextract_to "krml")]
let der_length_payload_size
(x: der_length_t)
: Tot (y: nat { y <= 126 })
= der_length_payload_size_of_tag (tag_of_der_length x)
val der_length_payload_size_le
(x1 x2: der_length_t)
: Lemma
(requires (x1 <= x2))
(ensures (der_length_payload_size x1 <= der_length_payload_size x2))
let lint (len: nat) : Tot Type = (x: nat { x < pow2 (8 * len) })
module U32 = FStar.UInt32
let tag_of_der_length32
(x: U32.t) | false | false | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tag_of_der_length32 (x: U32.t) : GTot U8.t | [] | LowParse.Spec.DER.tag_of_der_length32 | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: FStar.UInt32.t -> Prims.GTot FStar.UInt8.t | {
"end_col": 29,
"end_line": 102,
"start_col": 1,
"start_line": 101
} |
Prims.Tot | val parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
: Tot parser_kind | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind
= [@inline_let] let _ = der_length_payload_size_le min max in
strong_parser_kind (der_length_payload_size_of_tag (tag_of_der_length32' min)) (der_length_payload_size_of_tag (tag_of_der_length32' max)) None | val parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
: Tot parser_kind
let parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
: Tot parser_kind = | false | null | false | [@@ inline_let ]let _ = der_length_payload_size_le min max in
strong_parser_kind (der_length_payload_size_of_tag (tag_of_der_length32' min))
(der_length_payload_size_of_tag (tag_of_der_length32' max))
None | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"LowParse.Spec.DER.der_length_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"LowParse.Spec.Base.strong_parser_kind",
"LowParse.Spec.DER.der_length_payload_size_of_tag",
"LowParse.Spec.DER.tag_of_der_length32'",
"FStar.Pervasives.Native.None",
"LowParse.Spec.Base.parser_kind_metadata_some",
"Prims.unit",
"LowParse.Spec.DER.der_length_payload_size_le",
"LowParse.Spec.Base.parser_kind"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128
inline_for_extraction
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None
[@@(noextract_to "krml")]
let tag_of_der_length
(x: der_length_t)
: Tot U8.t
= if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` U8.uint_to_t len_len
[@@(noextract_to "krml")]
let der_length_payload_size
(x: der_length_t)
: Tot (y: nat { y <= 126 })
= der_length_payload_size_of_tag (tag_of_der_length x)
val der_length_payload_size_le
(x1 x2: der_length_t)
: Lemma
(requires (x1 <= x2))
(ensures (der_length_payload_size x1 <= der_length_payload_size x2))
let lint (len: nat) : Tot Type = (x: nat { x < pow2 (8 * len) })
module U32 = FStar.UInt32
let tag_of_der_length32
(x: U32.t)
: GTot U8.t
= let _ = assert_norm (pow2 32 - 1 <= der_length_max) in
tag_of_der_length (U32.v x)
val parse_der_length_payload32
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
: Tot (parser (parse_der_length_payload_kind x) (refine_with_tag tag_of_der_length32 x))
val parse_der_length_payload32_unfold
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Lemma
(
let y = parse (parse_der_length_payload32 x) input in
(256 < der_length_max) /\ (
if U8.v x < 128
then tag_of_der_length (U8.v x) == x /\ y == Some (Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then y == None
else if x = 129uy
then
match parse parse_u8 input with
| None -> y == None
| Some (z, consumed) ->
if U8.v z < 128
then y == None
else tag_of_der_length (U8.v z) == x /\ y == Some (Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
2 <= len /\ len <= 4 /\
(
let res : option (bounded_integer len & consumed_length input) = parse (parse_bounded_integer len) input in
match res with
| None -> y == None
| Some (z, consumed) ->
len > 0 /\ (
if U32.v z >= pow2 (8 * (len - 1))
then U32.v z <= der_length_max /\ tag_of_der_length32 z == x /\ y == Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else y == None
))))
val log256_eq
(x: nat)
: Lemma
(requires (x > 0 /\ x < 4294967296))
(ensures (log256 x == log256' x))
inline_for_extraction
let tag_of_der_length32'
(x: der_length_t { x < 4294967296 } )
: Tot (z: U8.t { z == tag_of_der_length x })
= if x < 128
then U8.uint_to_t x
else
[@inline_let]
let len_len = log256' x in
[@inline_let] let _ =
log256_eq x;
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126)
in
128uy `U8.add` U8.uint_to_t len_len
inline_for_extraction
let parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } ) | false | false | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
: Tot parser_kind | [] | LowParse.Spec.DER.parse_bounded_der_length_payload32_kind | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: LowParse.Spec.DER.der_length_t ->
max: LowParse.Spec.DER.der_length_t{min <= max /\ max < 4294967296}
-> LowParse.Spec.Base.parser_kind | {
"end_col": 145,
"end_line": 169,
"start_col": 2,
"start_line": 168
} |
Prims.Tot | val parse_bounded_der_length32_kind
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
: Tot parser_kind | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse_bounded_der_length32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind
=
[@inline_let]
let k = parse_bounded_der_length_payload32_kind min max in
strong_parser_kind (1 + der_length_payload_size_of_tag (tag_of_der_length32' min)) (1 + der_length_payload_size_of_tag (tag_of_der_length32' max)) None | val parse_bounded_der_length32_kind
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
: Tot parser_kind
let parse_bounded_der_length32_kind
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
: Tot parser_kind = | false | null | false | [@@ inline_let ]let k = parse_bounded_der_length_payload32_kind min max in
strong_parser_kind (1 + der_length_payload_size_of_tag (tag_of_der_length32' min))
(1 + der_length_payload_size_of_tag (tag_of_der_length32' max))
None | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"LowParse.Spec.DER.der_length_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"LowParse.Spec.Base.strong_parser_kind",
"Prims.op_Addition",
"LowParse.Spec.DER.der_length_payload_size_of_tag",
"LowParse.Spec.DER.tag_of_der_length32'",
"FStar.Pervasives.Native.None",
"LowParse.Spec.Base.parser_kind_metadata_some",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.DER.parse_bounded_der_length_payload32_kind"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128
inline_for_extraction
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None
[@@(noextract_to "krml")]
let tag_of_der_length
(x: der_length_t)
: Tot U8.t
= if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` U8.uint_to_t len_len
[@@(noextract_to "krml")]
let der_length_payload_size
(x: der_length_t)
: Tot (y: nat { y <= 126 })
= der_length_payload_size_of_tag (tag_of_der_length x)
val der_length_payload_size_le
(x1 x2: der_length_t)
: Lemma
(requires (x1 <= x2))
(ensures (der_length_payload_size x1 <= der_length_payload_size x2))
let lint (len: nat) : Tot Type = (x: nat { x < pow2 (8 * len) })
module U32 = FStar.UInt32
let tag_of_der_length32
(x: U32.t)
: GTot U8.t
= let _ = assert_norm (pow2 32 - 1 <= der_length_max) in
tag_of_der_length (U32.v x)
val parse_der_length_payload32
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
: Tot (parser (parse_der_length_payload_kind x) (refine_with_tag tag_of_der_length32 x))
val parse_der_length_payload32_unfold
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Lemma
(
let y = parse (parse_der_length_payload32 x) input in
(256 < der_length_max) /\ (
if U8.v x < 128
then tag_of_der_length (U8.v x) == x /\ y == Some (Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then y == None
else if x = 129uy
then
match parse parse_u8 input with
| None -> y == None
| Some (z, consumed) ->
if U8.v z < 128
then y == None
else tag_of_der_length (U8.v z) == x /\ y == Some (Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
2 <= len /\ len <= 4 /\
(
let res : option (bounded_integer len & consumed_length input) = parse (parse_bounded_integer len) input in
match res with
| None -> y == None
| Some (z, consumed) ->
len > 0 /\ (
if U32.v z >= pow2 (8 * (len - 1))
then U32.v z <= der_length_max /\ tag_of_der_length32 z == x /\ y == Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else y == None
))))
val log256_eq
(x: nat)
: Lemma
(requires (x > 0 /\ x < 4294967296))
(ensures (log256 x == log256' x))
inline_for_extraction
let tag_of_der_length32'
(x: der_length_t { x < 4294967296 } )
: Tot (z: U8.t { z == tag_of_der_length x })
= if x < 128
then U8.uint_to_t x
else
[@inline_let]
let len_len = log256' x in
[@inline_let] let _ =
log256_eq x;
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126)
in
128uy `U8.add` U8.uint_to_t len_len
inline_for_extraction
let parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind
= [@inline_let] let _ = der_length_payload_size_le min max in
strong_parser_kind (der_length_payload_size_of_tag (tag_of_der_length32' min)) (der_length_payload_size_of_tag (tag_of_der_length32' max)) None
inline_for_extraction
let parse_bounded_der_length32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind | false | false | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val parse_bounded_der_length32_kind
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
: Tot parser_kind | [] | LowParse.Spec.DER.parse_bounded_der_length32_kind | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
min: LowParse.Spec.DER.der_length_t ->
max: LowParse.Spec.DER.der_length_t{min <= max /\ max < 4294967296}
-> LowParse.Spec.Base.parser_kind | {
"end_col": 151,
"end_line": 179,
"start_col": 0,
"start_line": 177
} |
Prims.Tot | val log256_32 (n: U32.t{U32.v n > 0}) : Tot (y: U8.t{U8.v y == log256' (U32.v n)}) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let log256_32
(n: U32.t { U32.v n > 0 } )
: Tot (y: U8.t { U8.v y == log256' (U32.v n) } )
= if n `U32.lt` 256ul
then 1uy
else if n `U32.lt` 65536ul
then 2uy
else if n `U32.lt` 16777216ul
then 3uy
else 4uy | val log256_32 (n: U32.t{U32.v n > 0}) : Tot (y: U8.t{U8.v y == log256' (U32.v n)})
let log256_32 (n: U32.t{U32.v n > 0}) : Tot (y: U8.t{U8.v y == log256' (U32.v n)}) = | false | null | false | if n `U32.lt` 256ul
then 1uy
else if n `U32.lt` 65536ul then 2uy else if n `U32.lt` 16777216ul then 3uy else 4uy | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"FStar.UInt32.t",
"Prims.b2t",
"Prims.op_GreaterThan",
"FStar.UInt32.v",
"FStar.UInt32.lt",
"FStar.UInt32.__uint_to_t",
"FStar.UInt8.__uint_to_t",
"Prims.bool",
"FStar.UInt8.t",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt8.n",
"Prims.l_and",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThanOrEqual",
"FStar.UInt8.v",
"LowParse.Spec.BoundedInt.log256'"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128
inline_for_extraction
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None
[@@(noextract_to "krml")]
let tag_of_der_length
(x: der_length_t)
: Tot U8.t
= if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` U8.uint_to_t len_len
[@@(noextract_to "krml")]
let der_length_payload_size
(x: der_length_t)
: Tot (y: nat { y <= 126 })
= der_length_payload_size_of_tag (tag_of_der_length x)
val der_length_payload_size_le
(x1 x2: der_length_t)
: Lemma
(requires (x1 <= x2))
(ensures (der_length_payload_size x1 <= der_length_payload_size x2))
let lint (len: nat) : Tot Type = (x: nat { x < pow2 (8 * len) })
module U32 = FStar.UInt32
let tag_of_der_length32
(x: U32.t)
: GTot U8.t
= let _ = assert_norm (pow2 32 - 1 <= der_length_max) in
tag_of_der_length (U32.v x)
val parse_der_length_payload32
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
: Tot (parser (parse_der_length_payload_kind x) (refine_with_tag tag_of_der_length32 x))
val parse_der_length_payload32_unfold
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Lemma
(
let y = parse (parse_der_length_payload32 x) input in
(256 < der_length_max) /\ (
if U8.v x < 128
then tag_of_der_length (U8.v x) == x /\ y == Some (Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then y == None
else if x = 129uy
then
match parse parse_u8 input with
| None -> y == None
| Some (z, consumed) ->
if U8.v z < 128
then y == None
else tag_of_der_length (U8.v z) == x /\ y == Some (Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
2 <= len /\ len <= 4 /\
(
let res : option (bounded_integer len & consumed_length input) = parse (parse_bounded_integer len) input in
match res with
| None -> y == None
| Some (z, consumed) ->
len > 0 /\ (
if U32.v z >= pow2 (8 * (len - 1))
then U32.v z <= der_length_max /\ tag_of_der_length32 z == x /\ y == Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else y == None
))))
val log256_eq
(x: nat)
: Lemma
(requires (x > 0 /\ x < 4294967296))
(ensures (log256 x == log256' x))
inline_for_extraction
let tag_of_der_length32'
(x: der_length_t { x < 4294967296 } )
: Tot (z: U8.t { z == tag_of_der_length x })
= if x < 128
then U8.uint_to_t x
else
[@inline_let]
let len_len = log256' x in
[@inline_let] let _ =
log256_eq x;
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126)
in
128uy `U8.add` U8.uint_to_t len_len
inline_for_extraction
let parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind
= [@inline_let] let _ = der_length_payload_size_le min max in
strong_parser_kind (der_length_payload_size_of_tag (tag_of_der_length32' min)) (der_length_payload_size_of_tag (tag_of_der_length32' max)) None
inline_for_extraction
let parse_bounded_der_length32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind
=
[@inline_let]
let k = parse_bounded_der_length_payload32_kind min max in
strong_parser_kind (1 + der_length_payload_size_of_tag (tag_of_der_length32' min)) (1 + der_length_payload_size_of_tag (tag_of_der_length32' max)) None
val parse_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (parser (parse_bounded_der_length32_kind min max) (bounded_int32 min max))
val parse_bounded_der_length32_unfold
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
(input: bytes)
: Lemma
(let res = parse (parse_bounded_der_length32 min max) input in
match parse parse_u8 input with
| None -> res == None
| Some (x, consumed_x) ->
let len = der_length_payload_size_of_tag x in
if der_length_payload_size min <= len && len <= der_length_payload_size max then
let input' = Seq.slice input consumed_x (Seq.length input) in
len <= 4 /\ (
match parse (parse_der_length_payload32 x) input' with
| Some (y, consumed_y) ->
if min <= U32.v y && U32.v y <= max
then res == Some (y, consumed_x + consumed_y)
else res == None
| None -> res == None
) else
res == None
)
inline_for_extraction
let der_length_payload_size_of_tag8
(x: U8.t)
: Tot (y: U8.t { U8.v y == der_length_payload_size_of_tag x } )
= [@inline_let]
let _ =
assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max)
in
if x `U8.lt` 129uy || x = 255uy
then
0uy
else
x `U8.sub` 128uy
inline_for_extraction
let log256_32
(n: U32.t { U32.v n > 0 } ) | false | false | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val log256_32 (n: U32.t{U32.v n > 0}) : Tot (y: U8.t{U8.v y == log256' (U32.v n)}) | [] | LowParse.Spec.DER.log256_32 | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | n: FStar.UInt32.t{FStar.UInt32.v n > 0}
-> y: FStar.UInt8.t{FStar.UInt8.v y == LowParse.Spec.BoundedInt.log256' (FStar.UInt32.v n)} | {
"end_col": 10,
"end_line": 237,
"start_col": 2,
"start_line": 231
} |
Prims.Tot | val tag_of_der_length (x: der_length_t) : Tot U8.t | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tag_of_der_length
(x: der_length_t)
: Tot U8.t
= if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` U8.uint_to_t len_len | val tag_of_der_length (x: der_length_t) : Tot U8.t
let tag_of_der_length (x: der_length_t) : Tot U8.t = | false | null | false | if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` (U8.uint_to_t len_len) | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"LowParse.Spec.DER.der_length_t",
"Prims.op_LessThan",
"FStar.UInt8.uint_to_t",
"Prims.bool",
"FStar.UInt8.add",
"FStar.UInt8.__uint_to_t",
"Prims.unit",
"LowParse.Math.pow2_lt_recip",
"FStar.Mul.op_Star",
"Prims.op_Subtraction",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"LowParse.Spec.DER.der_length_max",
"Prims.pow2",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Multiply",
"LowParse.Spec.DER.log256",
"FStar.UInt8.t"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128
inline_for_extraction
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None
[@@(noextract_to "krml")]
let tag_of_der_length
(x: der_length_t) | false | true | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tag_of_der_length (x: der_length_t) : Tot U8.t | [] | LowParse.Spec.DER.tag_of_der_length | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: LowParse.Spec.DER.der_length_t -> FStar.UInt8.t | {
"end_col": 39,
"end_line": 80,
"start_col": 2,
"start_line": 74
} |
Prims.Tot | val der_length_payload_size_of_tag (x: U8.t) : Tot (y: nat{y <= 126}) | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128 | val der_length_payload_size_of_tag (x: U8.t) : Tot (y: nat{y <= 126})
let der_length_payload_size_of_tag (x: U8.t) : Tot (y: nat{y <= 126}) = | false | null | false | assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@@ inline_let ]let x' = U8.v x in
if x' <= 128 || x' = 255 then 0 else x' - 128 | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"FStar.UInt8.t",
"Prims.op_BarBar",
"Prims.op_LessThanOrEqual",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"Prims.op_Subtraction",
"Prims.nat",
"Prims.b2t",
"FStar.UInt.uint_t",
"FStar.UInt8.v",
"Prims.unit",
"Prims._assert",
"LowParse.Spec.DER.der_length_max",
"FStar.Pervasives.assert_norm",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.pow2",
"FStar.Mul.op_Star"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t) | false | false | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val der_length_payload_size_of_tag (x: U8.t) : Tot (y: nat{y <= 126}) | [] | LowParse.Spec.DER.der_length_payload_size_of_tag | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: FStar.UInt8.t -> y: Prims.nat{y <= 126} | {
"end_col": 12,
"end_line": 63,
"start_col": 2,
"start_line": 52
} |
Prims.Tot | val tag_of_der_length32' (x: der_length_t{x < 4294967296}) : Tot (z: U8.t{z == tag_of_der_length x}) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tag_of_der_length32'
(x: der_length_t { x < 4294967296 } )
: Tot (z: U8.t { z == tag_of_der_length x })
= if x < 128
then U8.uint_to_t x
else
[@inline_let]
let len_len = log256' x in
[@inline_let] let _ =
log256_eq x;
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126)
in
128uy `U8.add` U8.uint_to_t len_len | val tag_of_der_length32' (x: der_length_t{x < 4294967296}) : Tot (z: U8.t{z == tag_of_der_length x})
let tag_of_der_length32' (x: der_length_t{x < 4294967296}) : Tot (z: U8.t{z == tag_of_der_length x}) = | false | null | false | if x < 128
then U8.uint_to_t x
else
[@@ inline_let ]let len_len = log256' x in
[@@ inline_let ]let _ =
log256_eq x;
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126)
in
128uy `U8.add` (U8.uint_to_t len_len) | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"LowParse.Spec.DER.der_length_t",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.UInt8.uint_to_t",
"Prims.bool",
"FStar.UInt8.add",
"FStar.UInt8.__uint_to_t",
"Prims.unit",
"LowParse.Math.pow2_lt_recip",
"FStar.Mul.op_Star",
"Prims.op_Subtraction",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"LowParse.Spec.DER.der_length_max",
"Prims.pow2",
"LowParse.Spec.DER.log256_eq",
"LowParse.Spec.BoundedInt.integer_size",
"LowParse.Spec.BoundedInt.log256'",
"FStar.UInt8.t",
"LowParse.Spec.DER.tag_of_der_length"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128
inline_for_extraction
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None
[@@(noextract_to "krml")]
let tag_of_der_length
(x: der_length_t)
: Tot U8.t
= if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` U8.uint_to_t len_len
[@@(noextract_to "krml")]
let der_length_payload_size
(x: der_length_t)
: Tot (y: nat { y <= 126 })
= der_length_payload_size_of_tag (tag_of_der_length x)
val der_length_payload_size_le
(x1 x2: der_length_t)
: Lemma
(requires (x1 <= x2))
(ensures (der_length_payload_size x1 <= der_length_payload_size x2))
let lint (len: nat) : Tot Type = (x: nat { x < pow2 (8 * len) })
module U32 = FStar.UInt32
let tag_of_der_length32
(x: U32.t)
: GTot U8.t
= let _ = assert_norm (pow2 32 - 1 <= der_length_max) in
tag_of_der_length (U32.v x)
val parse_der_length_payload32
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
: Tot (parser (parse_der_length_payload_kind x) (refine_with_tag tag_of_der_length32 x))
val parse_der_length_payload32_unfold
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Lemma
(
let y = parse (parse_der_length_payload32 x) input in
(256 < der_length_max) /\ (
if U8.v x < 128
then tag_of_der_length (U8.v x) == x /\ y == Some (Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then y == None
else if x = 129uy
then
match parse parse_u8 input with
| None -> y == None
| Some (z, consumed) ->
if U8.v z < 128
then y == None
else tag_of_der_length (U8.v z) == x /\ y == Some (Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
2 <= len /\ len <= 4 /\
(
let res : option (bounded_integer len & consumed_length input) = parse (parse_bounded_integer len) input in
match res with
| None -> y == None
| Some (z, consumed) ->
len > 0 /\ (
if U32.v z >= pow2 (8 * (len - 1))
then U32.v z <= der_length_max /\ tag_of_der_length32 z == x /\ y == Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else y == None
))))
val log256_eq
(x: nat)
: Lemma
(requires (x > 0 /\ x < 4294967296))
(ensures (log256 x == log256' x))
inline_for_extraction
let tag_of_der_length32'
(x: der_length_t { x < 4294967296 } ) | false | false | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tag_of_der_length32' (x: der_length_t{x < 4294967296}) : Tot (z: U8.t{z == tag_of_der_length x}) | [] | LowParse.Spec.DER.tag_of_der_length32' | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: LowParse.Spec.DER.der_length_t{x < 4294967296}
-> z: FStar.UInt8.t{z == LowParse.Spec.DER.tag_of_der_length x} | {
"end_col": 39,
"end_line": 161,
"start_col": 2,
"start_line": 151
} |
Prims.Tot | val der_length_payload_size_of_tag8 (x: U8.t)
: Tot (y: U8.t{U8.v y == der_length_payload_size_of_tag x}) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let der_length_payload_size_of_tag8
(x: U8.t)
: Tot (y: U8.t { U8.v y == der_length_payload_size_of_tag x } )
= [@inline_let]
let _ =
assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max)
in
if x `U8.lt` 129uy || x = 255uy
then
0uy
else
x `U8.sub` 128uy | val der_length_payload_size_of_tag8 (x: U8.t)
: Tot (y: U8.t{U8.v y == der_length_payload_size_of_tag x})
let der_length_payload_size_of_tag8 (x: U8.t)
: Tot (y: U8.t{U8.v y == der_length_payload_size_of_tag x}) = | false | null | false | [@@ inline_let ]let _ =
assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max)
in
if x `U8.lt` 129uy || x = 255uy then 0uy else x `U8.sub` 128uy | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"FStar.UInt8.t",
"Prims.op_BarBar",
"FStar.UInt8.lt",
"FStar.UInt8.__uint_to_t",
"Prims.op_Equality",
"Prims.bool",
"FStar.UInt8.sub",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt8.n",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThanOrEqual",
"FStar.UInt8.v",
"LowParse.Spec.DER.der_length_payload_size_of_tag",
"Prims.unit",
"Prims._assert",
"LowParse.Spec.DER.der_length_max",
"FStar.Pervasives.assert_norm",
"Prims.op_LessThan",
"Prims.pow2",
"Prims.op_Subtraction",
"FStar.Mul.op_Star"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128
inline_for_extraction
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None
[@@(noextract_to "krml")]
let tag_of_der_length
(x: der_length_t)
: Tot U8.t
= if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` U8.uint_to_t len_len
[@@(noextract_to "krml")]
let der_length_payload_size
(x: der_length_t)
: Tot (y: nat { y <= 126 })
= der_length_payload_size_of_tag (tag_of_der_length x)
val der_length_payload_size_le
(x1 x2: der_length_t)
: Lemma
(requires (x1 <= x2))
(ensures (der_length_payload_size x1 <= der_length_payload_size x2))
let lint (len: nat) : Tot Type = (x: nat { x < pow2 (8 * len) })
module U32 = FStar.UInt32
let tag_of_der_length32
(x: U32.t)
: GTot U8.t
= let _ = assert_norm (pow2 32 - 1 <= der_length_max) in
tag_of_der_length (U32.v x)
val parse_der_length_payload32
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
: Tot (parser (parse_der_length_payload_kind x) (refine_with_tag tag_of_der_length32 x))
val parse_der_length_payload32_unfold
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Lemma
(
let y = parse (parse_der_length_payload32 x) input in
(256 < der_length_max) /\ (
if U8.v x < 128
then tag_of_der_length (U8.v x) == x /\ y == Some (Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then y == None
else if x = 129uy
then
match parse parse_u8 input with
| None -> y == None
| Some (z, consumed) ->
if U8.v z < 128
then y == None
else tag_of_der_length (U8.v z) == x /\ y == Some (Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
2 <= len /\ len <= 4 /\
(
let res : option (bounded_integer len & consumed_length input) = parse (parse_bounded_integer len) input in
match res with
| None -> y == None
| Some (z, consumed) ->
len > 0 /\ (
if U32.v z >= pow2 (8 * (len - 1))
then U32.v z <= der_length_max /\ tag_of_der_length32 z == x /\ y == Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else y == None
))))
val log256_eq
(x: nat)
: Lemma
(requires (x > 0 /\ x < 4294967296))
(ensures (log256 x == log256' x))
inline_for_extraction
let tag_of_der_length32'
(x: der_length_t { x < 4294967296 } )
: Tot (z: U8.t { z == tag_of_der_length x })
= if x < 128
then U8.uint_to_t x
else
[@inline_let]
let len_len = log256' x in
[@inline_let] let _ =
log256_eq x;
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126)
in
128uy `U8.add` U8.uint_to_t len_len
inline_for_extraction
let parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind
= [@inline_let] let _ = der_length_payload_size_le min max in
strong_parser_kind (der_length_payload_size_of_tag (tag_of_der_length32' min)) (der_length_payload_size_of_tag (tag_of_der_length32' max)) None
inline_for_extraction
let parse_bounded_der_length32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind
=
[@inline_let]
let k = parse_bounded_der_length_payload32_kind min max in
strong_parser_kind (1 + der_length_payload_size_of_tag (tag_of_der_length32' min)) (1 + der_length_payload_size_of_tag (tag_of_der_length32' max)) None
val parse_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (parser (parse_bounded_der_length32_kind min max) (bounded_int32 min max))
val parse_bounded_der_length32_unfold
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
(input: bytes)
: Lemma
(let res = parse (parse_bounded_der_length32 min max) input in
match parse parse_u8 input with
| None -> res == None
| Some (x, consumed_x) ->
let len = der_length_payload_size_of_tag x in
if der_length_payload_size min <= len && len <= der_length_payload_size max then
let input' = Seq.slice input consumed_x (Seq.length input) in
len <= 4 /\ (
match parse (parse_der_length_payload32 x) input' with
| Some (y, consumed_y) ->
if min <= U32.v y && U32.v y <= max
then res == Some (y, consumed_x + consumed_y)
else res == None
| None -> res == None
) else
res == None
)
inline_for_extraction
let der_length_payload_size_of_tag8
(x: U8.t) | false | false | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val der_length_payload_size_of_tag8 (x: U8.t)
: Tot (y: U8.t{U8.v y == der_length_payload_size_of_tag x}) | [] | LowParse.Spec.DER.der_length_payload_size_of_tag8 | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: FStar.UInt8.t
-> y: FStar.UInt8.t{FStar.UInt8.v y == LowParse.Spec.DER.der_length_payload_size_of_tag x} | {
"end_col": 20,
"end_line": 225,
"start_col": 2,
"start_line": 213
} |
Prims.Tot | val tag_of_der_length32_impl (x: U32.t)
: Tot (y: U8.t{U32.v x < der_length_max /\ y == tag_of_der_length (U32.v x)}) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.Endianness",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.SeqBytes.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "LowParse.Math",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tag_of_der_length32_impl
(x: U32.t)
: Tot (y: U8.t { U32.v x < der_length_max /\ y == tag_of_der_length (U32.v x) } )
= [@inline_let]
let _ = assert_norm (4294967296 <= der_length_max) in
if x `U32.lt` 128ul
then begin
[@inline_let] let _ = FStar.Math.Lemmas.small_modulo_lemma_1 (U32.v x) 256 in
Cast.uint32_to_uint8 x <: U8.t
end else
let len_len = log256_32 x in
[@inline_let] let _ =
log256_eq (U32.v x);
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (U8.v len_len - 1)) (8 * 126)
in
128uy `U8.add` len_len | val tag_of_der_length32_impl (x: U32.t)
: Tot (y: U8.t{U32.v x < der_length_max /\ y == tag_of_der_length (U32.v x)})
let tag_of_der_length32_impl (x: U32.t)
: Tot (y: U8.t{U32.v x < der_length_max /\ y == tag_of_der_length (U32.v x)}) = | false | null | false | [@@ inline_let ]let _ = assert_norm (4294967296 <= der_length_max) in
if x `U32.lt` 128ul
then
[@@ inline_let ]let _ = FStar.Math.Lemmas.small_modulo_lemma_1 (U32.v x) 256 in
Cast.uint32_to_uint8 x <: U8.t
else
let len_len = log256_32 x in
[@@ inline_let ]let _ =
log256_eq (U32.v x);
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (U8.v len_len - 1)) (8 * 126)
in
128uy `U8.add` len_len | {
"checked_file": "LowParse.Spec.DER.fsti.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Math.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.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.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.DER.fsti"
} | [
"total"
] | [
"FStar.UInt32.t",
"FStar.UInt32.lt",
"FStar.UInt32.__uint_to_t",
"FStar.Int.Cast.uint32_to_uint8",
"FStar.UInt8.t",
"Prims.unit",
"FStar.Math.Lemmas.small_modulo_lemma_1",
"FStar.UInt32.v",
"Prims.bool",
"FStar.UInt8.add",
"FStar.UInt8.__uint_to_t",
"LowParse.Math.pow2_lt_recip",
"FStar.Mul.op_Star",
"Prims.op_Subtraction",
"FStar.UInt8.v",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"LowParse.Spec.DER.der_length_max",
"Prims.pow2",
"LowParse.Spec.DER.log256_eq",
"Prims.l_or",
"FStar.UInt.size",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThanOrEqual",
"LowParse.Spec.BoundedInt.log256'",
"LowParse.Spec.DER.log256_32",
"Prims.op_LessThan",
"LowParse.Spec.DER.tag_of_der_length"
] | [] | module LowParse.Spec.DER
include LowParse.Spec.Int
include LowParse.Spec.BoundedInt
open FStar.Mul
module U8 = FStar.UInt8
module UInt = FStar.UInt
module Seq = FStar.Seq
module Math = LowParse.Math
module Cast = FStar.Int.Cast
#reset-options "--z3cliopt smt.arith.nl=false --max_fuel 0 --max_ifuel 0"
let der_length_max : nat = 2743062034396844341627968125593604635037196317966166035056000994228098690879836473582587849768181396806642362668936055872479091931372323951612051859122835149807249350355003132267795098895967012320756270631179897595796976964454084495146379250195728106130226298287754794921070036903071843030324651025760255
// _ by (FStar.Tactics.(exact (norm_term [delta; iota; zeta; primops] (`(pow2 (8 * 126) - 1)))))
val der_length_max_eq : squash (der_length_max == pow2 (8 * 126) - 1)
// let _ = intro_ambient der_length_max
let der_length_t = (x: nat { x <= der_length_max })
[@@(noextract_to "krml")]
val log256
(x: nat { x > 0 })
: Tot (y: nat { y > 0 /\ pow2 (8 * (y - 1)) <= x /\ x < pow2 (8 * y)})
val log256_unique
(x: nat)
(y: nat)
: Lemma
(requires (
x > 0 /\
y > 0 /\
pow2 (8 * (y - 1)) <= x /\
x < pow2 (8 * y)
))
(ensures (y == log256 x))
val log256_le
(x1 x2: nat)
: Lemma
(requires (0 < x1 /\ x1 <= x2))
(ensures (log256 x1 <= log256 x2))
inline_for_extraction // for parser_kind
let der_length_payload_size_of_tag
(x: U8.t)
: Tot (y: nat { y <= 126 })
= assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max);
[@inline_let]
let x' = U8.v x in
if x' <= 128 || x' = 255
then
0
else
x' - 128
inline_for_extraction
let parse_der_length_payload_kind (x: U8.t) : Tot parser_kind =
let len = der_length_payload_size_of_tag x in
strong_parser_kind len len None
[@@(noextract_to "krml")]
let tag_of_der_length
(x: der_length_t)
: Tot U8.t
= if x < 128
then U8.uint_to_t x
else
let len_len = log256 x in
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126);
128uy `U8.add` U8.uint_to_t len_len
[@@(noextract_to "krml")]
let der_length_payload_size
(x: der_length_t)
: Tot (y: nat { y <= 126 })
= der_length_payload_size_of_tag (tag_of_der_length x)
val der_length_payload_size_le
(x1 x2: der_length_t)
: Lemma
(requires (x1 <= x2))
(ensures (der_length_payload_size x1 <= der_length_payload_size x2))
let lint (len: nat) : Tot Type = (x: nat { x < pow2 (8 * len) })
module U32 = FStar.UInt32
let tag_of_der_length32
(x: U32.t)
: GTot U8.t
= let _ = assert_norm (pow2 32 - 1 <= der_length_max) in
tag_of_der_length (U32.v x)
val parse_der_length_payload32
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
: Tot (parser (parse_der_length_payload_kind x) (refine_with_tag tag_of_der_length32 x))
val parse_der_length_payload32_unfold
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Lemma
(
let y = parse (parse_der_length_payload32 x) input in
(256 < der_length_max) /\ (
if U8.v x < 128
then tag_of_der_length (U8.v x) == x /\ y == Some (Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then y == None
else if x = 129uy
then
match parse parse_u8 input with
| None -> y == None
| Some (z, consumed) ->
if U8.v z < 128
then y == None
else tag_of_der_length (U8.v z) == x /\ y == Some (Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
2 <= len /\ len <= 4 /\
(
let res : option (bounded_integer len & consumed_length input) = parse (parse_bounded_integer len) input in
match res with
| None -> y == None
| Some (z, consumed) ->
len > 0 /\ (
if U32.v z >= pow2 (8 * (len - 1))
then U32.v z <= der_length_max /\ tag_of_der_length32 z == x /\ y == Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else y == None
))))
val log256_eq
(x: nat)
: Lemma
(requires (x > 0 /\ x < 4294967296))
(ensures (log256 x == log256' x))
inline_for_extraction
let tag_of_der_length32'
(x: der_length_t { x < 4294967296 } )
: Tot (z: U8.t { z == tag_of_der_length x })
= if x < 128
then U8.uint_to_t x
else
[@inline_let]
let len_len = log256' x in
[@inline_let] let _ =
log256_eq x;
assert_norm (der_length_max == pow2 (8 * 126) - 1);
Math.pow2_lt_recip (8 * (len_len - 1)) (8 * 126)
in
128uy `U8.add` U8.uint_to_t len_len
inline_for_extraction
let parse_bounded_der_length_payload32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind
= [@inline_let] let _ = der_length_payload_size_le min max in
strong_parser_kind (der_length_payload_size_of_tag (tag_of_der_length32' min)) (der_length_payload_size_of_tag (tag_of_der_length32' max)) None
inline_for_extraction
let parse_bounded_der_length32_kind
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 } )
: Tot parser_kind
=
[@inline_let]
let k = parse_bounded_der_length_payload32_kind min max in
strong_parser_kind (1 + der_length_payload_size_of_tag (tag_of_der_length32' min)) (1 + der_length_payload_size_of_tag (tag_of_der_length32' max)) None
val parse_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (parser (parse_bounded_der_length32_kind min max) (bounded_int32 min max))
val parse_bounded_der_length32_unfold
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
(input: bytes)
: Lemma
(let res = parse (parse_bounded_der_length32 min max) input in
match parse parse_u8 input with
| None -> res == None
| Some (x, consumed_x) ->
let len = der_length_payload_size_of_tag x in
if der_length_payload_size min <= len && len <= der_length_payload_size max then
let input' = Seq.slice input consumed_x (Seq.length input) in
len <= 4 /\ (
match parse (parse_der_length_payload32 x) input' with
| Some (y, consumed_y) ->
if min <= U32.v y && U32.v y <= max
then res == Some (y, consumed_x + consumed_y)
else res == None
| None -> res == None
) else
res == None
)
inline_for_extraction
let der_length_payload_size_of_tag8
(x: U8.t)
: Tot (y: U8.t { U8.v y == der_length_payload_size_of_tag x } )
= [@inline_let]
let _ =
assert_norm (der_length_max == pow2 (8 * 126) - 1);
assert_norm (pow2 7 == 128);
assert_norm (pow2 8 == 256);
assert_norm (256 < der_length_max);
assert (U8.v x <= der_length_max)
in
if x `U8.lt` 129uy || x = 255uy
then
0uy
else
x `U8.sub` 128uy
inline_for_extraction
let log256_32
(n: U32.t { U32.v n > 0 } )
: Tot (y: U8.t { U8.v y == log256' (U32.v n) } )
= if n `U32.lt` 256ul
then 1uy
else if n `U32.lt` 65536ul
then 2uy
else if n `U32.lt` 16777216ul
then 3uy
else 4uy
inline_for_extraction
let tag_of_der_length32_impl
(x: U32.t) | false | false | LowParse.Spec.DER.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tag_of_der_length32_impl (x: U32.t)
: Tot (y: U8.t{U32.v x < der_length_max /\ y == tag_of_der_length (U32.v x)}) | [] | LowParse.Spec.DER.tag_of_der_length32_impl | {
"file_name": "src/lowparse/LowParse.Spec.DER.fsti",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: FStar.UInt32.t
-> y:
FStar.UInt8.t
{ FStar.UInt32.v x < LowParse.Spec.DER.der_length_max /\
y == LowParse.Spec.DER.tag_of_der_length (FStar.UInt32.v x) } | {
"end_col": 26,
"end_line": 256,
"start_col": 2,
"start_line": 243
} |
FStar.HyperStack.ST.St | val test_incremental_api: Prims.unit -> St unit | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "LowStar.ModifiesPat",
"short_module": "MP"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "EverCrypt.Hash.Incremental",
"short_module": "HI"
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let test_incremental_api (): St unit =
// Note: this function cannot be in the Stack effect because it performs some
// allocations (even though it frees them afterwards).
push_frame ();
let b1 = B.alloca_of_list [ u8 0x00; u8 0x01; u8 0x02; u8 0x04 ] in
let b2 = B.alloca_of_list [ u8 0x05; u8 0x06; u8 0x07; u8 0x08 ] in
let st = HI.create_in SHA2_256 HyperStack.root in
HI.init (G.hide SHA2_256) st;
let h0 = ST.get () in
assert B.(loc_disjoint (S.footprint HI.evercrypt_hash SHA2_256 h0 st) (loc_buffer b1));
assert (S.seen HI.evercrypt_hash SHA2_256 h0 st `Seq.equal` Seq.empty);
assert_norm (4 < pow2 61);
let EverCrypt.Error.Success = HI.update (G.hide SHA2_256) st b1 4ul in
let h1 = ST.get () in
assert (HI.hashed h1 st `Seq.equal` (Seq.append Seq.empty (B.as_seq h0 b1)));
Seq.append_empty_l (B.as_seq h0 b1);
assert (HI.hashed h1 st `Seq.equal` (B.as_seq h0 b1));
assert (Seq.length (Ghost.reveal (Ghost.hide (B.as_seq h0 b1))) = 4);
assert_norm (8 < pow2 61);
let EverCrypt.Error.Success = HI.update (G.hide SHA2_256) st b2 4ul in
let h2 = ST.get () in
assert (HI.hashed h2 st `Seq.equal` (Seq.append (B.as_seq h0 b1) (B.as_seq h0 b2)));
// An example of how to call the hash preservation lemma...
let dst = B.alloca (u8 0) 32ul in
let h3 = ST.get () in
// Auto-framing!
HI.finish (G.hide SHA2_256) st dst ();
let h4 = ST.get () in
assert (Seq.equal (B.as_seq h4 dst)
(Spec.Agile.Hash.hash SHA2_256 (Seq.append (B.as_seq h0 b1) (B.as_seq h0 b2))));
HI.free (G.hide SHA2_256) st;
pop_frame () | val test_incremental_api: Prims.unit -> St unit
let test_incremental_api () : St unit = | true | null | false | push_frame ();
let b1 = B.alloca_of_list [u8 0x00; u8 0x01; u8 0x02; u8 0x04] in
let b2 = B.alloca_of_list [u8 0x05; u8 0x06; u8 0x07; u8 0x08] in
let st = HI.create_in SHA2_256 HyperStack.root in
HI.init (G.hide SHA2_256) st;
let h0 = ST.get () in
assert B.(loc_disjoint (S.footprint HI.evercrypt_hash SHA2_256 h0 st) (loc_buffer b1));
assert ((S.seen HI.evercrypt_hash SHA2_256 h0 st) `Seq.equal` Seq.empty);
assert_norm (4 < pow2 61);
let EverCrypt.Error.Success = HI.update (G.hide SHA2_256) st b1 4ul in
let h1 = ST.get () in
assert ((HI.hashed h1 st) `Seq.equal` (Seq.append Seq.empty (B.as_seq h0 b1)));
Seq.append_empty_l (B.as_seq h0 b1);
assert ((HI.hashed h1 st) `Seq.equal` (B.as_seq h0 b1));
assert (Seq.length (Ghost.reveal (Ghost.hide (B.as_seq h0 b1))) = 4);
assert_norm (8 < pow2 61);
let EverCrypt.Error.Success = HI.update (G.hide SHA2_256) st b2 4ul in
let h2 = ST.get () in
assert ((HI.hashed h2 st) `Seq.equal` (Seq.append (B.as_seq h0 b1) (B.as_seq h0 b2)));
let dst = B.alloca (u8 0) 32ul in
let h3 = ST.get () in
HI.finish (G.hide SHA2_256) st dst ();
let h4 = ST.get () in
assert (Seq.equal (B.as_seq h4 dst)
(Spec.Agile.Hash.hash SHA2_256 (Seq.append (B.as_seq h0 b1) (B.as_seq h0 b2))));
HI.free (G.hide SHA2_256) st;
pop_frame () | {
"checked_file": "Test.Hash.fst.checked",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Hash.Incremental.fst.checked"
],
"interface_file": false,
"source_file": "Test.Hash.fst"
} | [] | [
"Prims.unit",
"FStar.HyperStack.ST.pop_frame",
"EverCrypt.Hash.Incremental.free",
"FStar.Ghost.hide",
"EverCrypt.Hash.alg",
"Spec.Hash.Definitions.SHA2_256",
"Prims._assert",
"FStar.Seq.Base.equal",
"Hacl.Streaming.Functor.uint8",
"LowStar.Monotonic.Buffer.as_seq",
"LowStar.Buffer.trivial_preorder",
"Spec.Agile.Hash.hash",
"FStar.Seq.Base.append",
"Hacl.Streaming.Interface.uint8",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"EverCrypt.Hash.Incremental.finish",
"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",
"Lib.IntTypes.u8",
"FStar.UInt32.__uint_to_t",
"EverCrypt.Hash.Incremental.hashed",
"EverCrypt.Error.error_code",
"EverCrypt.Hash.Incremental.update",
"FStar.Pervasives.assert_norm",
"Prims.op_LessThan",
"Prims.pow2",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Ghost.reveal",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.append_empty_l",
"FStar.Seq.Base.empty",
"Hacl.Streaming.Functor.seen",
"Spec.Hash.Definitions.fixed_len_alg",
"EverCrypt.Hash.Incremental.evercrypt_hash",
"LowStar.Monotonic.Buffer.loc_disjoint",
"Hacl.Streaming.Functor.footprint",
"LowStar.Monotonic.Buffer.loc_buffer",
"EverCrypt.Hash.Incremental.init",
"Hacl.Streaming.Functor.state",
"EverCrypt.Hash.state",
"FStar.Ghost.erased",
"EverCrypt.Hash.Incremental.create_in",
"FStar.Monotonic.HyperHeap.root",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.length",
"Prims.Cons",
"Lib.IntTypes.mk_int",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.Nil",
"LowStar.Buffer.alloca_of_list",
"FStar.HyperStack.ST.push_frame"
] | [] | module Test.Hash
module HI = EverCrypt.Hash.Incremental
module S = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
module M = LowStar.Modifies
module MP = LowStar.ModifiesPat
module B = LowStar.Buffer
module G = FStar.Ghost
open LowStar.BufferOps
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
open Lib.IntTypes
open FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0"
let main (): St unit =
// Nothing here: EverCrypt.Hash is no longer a public API, all clients
// expected to go through HI
()
#push-options "--z3rlimit 100 --fuel 1 --ifuel 1"
let test_incremental_api (): St unit =
// Note: this function cannot be in the Stack effect because it performs some | false | false | Test.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val test_incremental_api: Prims.unit -> St unit | [] | Test.Hash.test_incremental_api | {
"file_name": "providers/test/Test.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.HyperStack.ST.St Prims.unit | {
"end_col": 14,
"end_line": 66,
"start_col": 2,
"start_line": 32
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let uint16_view = Vale.Interop.Views.up_view16 | let uint16_view = | false | null | false | Vale.Interop.Views.up_view16 | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"Vale.Interop.Views.up_view16"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
() | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint16_view : LowStar.BufferView.Up.view FStar.UInt8.t FStar.UInt16.t | [] | Vale.X64.Memory.uint16_view | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | LowStar.BufferView.Up.view FStar.UInt8.t FStar.UInt16.t | {
"end_col": 46,
"end_line": 59,
"start_col": 18,
"start_line": 59
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let b8 = IB.b8 | let b8 = | false | null | false | IB.b8 | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"Vale.Interop.Types.b8"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val b8 : Type0 | [] | Vale.X64.Memory.b8 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 14,
"end_line": 23,
"start_col": 9,
"start_line": 23
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tuint8 = UInt8.t | let tuint8 = | false | null | false | UInt8.t | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"FStar.UInt8.t"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tuint8 : Prims.eqtype | [] | Vale.X64.Memory.tuint8 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.eqtype | {
"end_col": 20,
"end_line": 31,
"start_col": 13,
"start_line": 31
} |
|
Prims.Tot | val get_heaplet_id (h:vale_heap) : option heaplet_id | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let get_heaplet_id h =
h.heapletId | val get_heaplet_id (h:vale_heap) : option heaplet_id
let get_heaplet_id h = | false | null | false | h.heapletId | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"Vale.Arch.HeapImpl.vale_heap",
"Vale.Arch.HeapImpl.__proj__ValeHeap__item__heapletId",
"FStar.Pervasives.Native.option",
"Vale.Arch.HeapImpl.heaplet_id"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val get_heaplet_id (h:vale_heap) : option heaplet_id | [] | Vale.X64.Memory.get_heaplet_id | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | h: Vale.Arch.HeapImpl.vale_heap -> FStar.Pervasives.Native.option Vale.Arch.HeapImpl.heaplet_id | {
"end_col": 13,
"end_line": 29,
"start_col": 2,
"start_line": 29
} |
Prims.GTot | val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0 | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h)) | val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
let buffer_readable #t h b = | false | null | false | List.memP b (IB.ptrs_of_mem (_ih h)) | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"sometrivial"
] | [
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.Arch.HeapImpl.vale_heap",
"Vale.X64.Memory.buffer",
"FStar.List.Tot.Base.memP",
"Vale.Interop.Types.b8",
"Vale.Interop.Heap_s.ptrs_of_mem",
"Vale.Arch.HeapImpl._ih",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s | false | false | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0 | [] | Vale.X64.Memory.buffer_readable | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | h: Vale.Arch.HeapImpl.vale_heap -> b: Vale.X64.Memory.buffer t -> Prims.GTot Vale.Def.Prop_s.prop0 | {
"end_col": 65,
"end_line": 76,
"start_col": 29,
"start_line": 76
} |
Prims.GTot | val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0 | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let buffer_writeable #t b = b.writeable | val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
let buffer_writeable #t b = | false | null | false | b.writeable | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"sometrivial"
] | [
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.X64.Memory.buffer",
"Prims.b2t",
"Vale.Interop.Types.__proj__Buffer__item__writeable",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s | false | false | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0 | [] | Vale.X64.Memory.buffer_writeable | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Vale.X64.Memory.buffer t -> Prims.GTot Vale.Def.Prop_s.prop0 | {
"end_col": 39,
"end_line": 77,
"start_col": 28,
"start_line": 77
} |
Prims.GTot | val loc_disjoint (s1 s2:loc) : GTot prop0 | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let loc_disjoint = M.loc_disjoint | val loc_disjoint (s1 s2:loc) : GTot prop0
let loc_disjoint = | false | null | false | M.loc_disjoint | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"sometrivial"
] | [
"LowStar.Monotonic.Buffer.loc_disjoint"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union | false | false | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val loc_disjoint (s1 s2:loc) : GTot prop0 | [] | Vale.X64.Memory.loc_disjoint | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s1: Vale.X64.Memory.loc -> s2: Vale.X64.Memory.loc -> Prims.GTot Vale.Def.Prop_s.prop0 | {
"end_col": 33,
"end_line": 83,
"start_col": 19,
"start_line": 83
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let uint32_view = Vale.Interop.Views.up_view32 | let uint32_view = | false | null | false | Vale.Interop.Views.up_view32 | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"Vale.Interop.Views.up_view32"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8 | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint32_view : LowStar.BufferView.Up.view FStar.UInt8.t FStar.UInt32.t | [] | Vale.X64.Memory.uint32_view | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | LowStar.BufferView.Up.view FStar.UInt8.t FStar.UInt32.t | {
"end_col": 46,
"end_line": 60,
"start_col": 18,
"start_line": 60
} |
|
Prims.GTot | val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0 | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let modifies_goal_directed s h1 h2 = modifies s h1 h2 | val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0
let modifies_goal_directed s h1 h2 = | false | null | false | modifies s h1 h2 | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"sometrivial"
] | [
"Vale.X64.Memory.loc",
"Vale.Arch.HeapImpl.vale_heap",
"Vale.X64.Memory.modifies",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union
let loc_buffer #t b = M.loc_buffer b.bsrc
let loc_disjoint = M.loc_disjoint
let loc_includes = M.loc_includes
let modifies s h h' =
M.modifies s (_ih h).hs (_ih h').hs /\
h.heapletId == h'.heapletId /\
(_ih h).ptrs == (_ih h').ptrs /\
(_ih h).addrs == (_ih h').addrs /\
HST.equal_domains (_ih h).hs (_ih h').hs
let buffer_addr #t b h = IB.addrs_of_mem (_ih h) b
open FStar.Mul
#set-options "--z3rlimit 20"
let index64_heap_aux (s:Seq.lseq UInt8.t 8) (heap:S.machine_heap) (ptr:int) : Lemma
(requires forall (j:nat{j < 8}). UInt8.v (Seq.index s j) == heap.[ptr+j])
(ensures UInt64.v (Vale.Interop.Views.get64 s) == S.get_heap_val64 ptr heap) =
let open Vale.Def.Words.Seq_s in
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
Vale.Interop.Views.get64_reveal ();
S.get_heap_val64_reveal ();
Vale.Def.Types_s.le_bytes_to_nat64_reveal ()
let index_helper (x y:int) (heap:S.machine_heap) : Lemma
(requires x == y)
(ensures heap.[x] == heap.[y])
=
()
let index_mul_helper (addr i n j:int) : Lemma
(addr + (i * n + j) == addr + n * i + j) =
()
#set-options "--max_fuel 0 --max_ifuel 0"
let index64_get_heap_val64
(h:vale_heap)
(b:buffer64{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma (Seq.index (buffer_as_seq h b) i == S.get_heap_val64 (buffer_addr b h + scale8 i) heap)
=
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db uint64_view in
let ptr = buffer_addr b h + scale8 i in
let s = DV.as_seq (_ih h).hs db in
let t = TUInt64 in
let addr = buffer_addr b h in
UV.length_eq ub;
UV.as_seq_sel (_ih h).hs ub i;
UV.get_sel (_ih h).hs ub i;
let s' = Seq.slice s (i*8) (i*8 + 8) in
let aux (j:nat{j < 8}) : Lemma (UInt8.v (Seq.index s' j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*8 + j)) == heap.[addr + (i*8+j)]);
Seq.lemma_index_slice s (i*8) (i*8+8) j;
assert (UInt8.v (Seq.index s' j) == heap.[addr+(i*8+j)]);
index_mul_helper addr i 8 j;
()
in Classical.forall_intro aux;
index64_heap_aux s' heap ptr
#set-options "--z3rlimit 50"
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Four_s
open Vale.Lib.Seqs_s
let index128_get_heap_val128_aux (s:Seq.lseq UInt8.t 16) (ptr:int) (heap:S.machine_heap) : Lemma
(requires (forall (j:nat) . j < 16 ==> UInt8.v (Seq.index s j) == heap.[ptr+j]))
(ensures Vale.Interop.Views.get128 s == Mkfour
(S.get_heap_val32 ptr heap)
(S.get_heap_val32 (ptr+4) heap)
(S.get_heap_val32 (ptr+8) heap)
(S.get_heap_val32 (ptr+12) heap)) =
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
S.get_heap_val32_reveal ();
Vale.Interop.Views.get128_reveal ();
Vale.Def.Types_s.le_bytes_to_quad32_reveal ()
let index128_get_heap_val128
(h:vale_heap)
(b:buffer128{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma
(ensures (
let addr = buffer_addr b h in
Seq.index (buffer_as_seq h b) i ==
Mkfour
(S.get_heap_val32 (addr + scale16 i) heap)
(S.get_heap_val32 (addr + scale16 i+4) heap)
(S.get_heap_val32 (addr + scale16 i+8) heap)
(S.get_heap_val32 (addr + scale16 i +12) heap)
))
=
let db = get_downview b.bsrc in
let vb = UV.mk_buffer db uint128_view in
let ptr = buffer_addr b h + scale16 i in
let s = DV.as_seq (_ih h).hs db in
let addr = buffer_addr b h in
UV.length_eq vb;
UV.as_seq_sel (_ih h).hs vb i;
UV.get_sel (_ih h).hs vb i;
let sl = Seq.slice s (i*16) (i*16+16) in
let aux (j:nat{j < 16}) : Lemma (UInt8.v (Seq.index sl j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*16 + j)) == heap.[addr + (i*16+j)]);
Seq.lemma_index_slice s (i*16) (i*16+16) j;
assert (UInt8.v (Seq.index sl j) == heap.[addr+(i*16+j)]);
index_mul_helper addr i 16 j
in Classical.forall_intro aux;
index128_get_heap_val128_aux sl ptr heap | false | false | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": 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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0 | [] | Vale.X64.Memory.modifies_goal_directed | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: Vale.X64.Memory.loc -> h1: Vale.Arch.HeapImpl.vale_heap -> h2: Vale.Arch.HeapImpl.vale_heap
-> Prims.GTot Vale.Def.Prop_s.prop0 | {
"end_col": 53,
"end_line": 198,
"start_col": 37,
"start_line": 198
} |
Prims.Tot | val loc : Type u#0 | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let loc = M.loc | val loc : Type u#0
let loc = | false | null | false | M.loc | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"LowStar.Monotonic.Buffer.loc"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val loc : Type u#0 | [] | Vale.X64.Memory.loc | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 15,
"end_line": 79,
"start_col": 10,
"start_line": 79
} |
Prims.GTot | val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32 | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let load_mem128 ptr h =
if not (valid_mem128 ptr h) then (default_of_typ (TUInt128))
else load_mem (TUInt128) ptr h | val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32
let load_mem128 ptr h = | false | null | false | if not (valid_mem128 ptr h) then (default_of_typ (TUInt128)) else load_mem (TUInt128) ptr h | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.Arch.HeapImpl.vale_heap",
"Prims.op_Negation",
"Vale.X64.Memory.valid_mem128",
"Vale.X64.Memory.default_of_typ",
"Vale.Arch.HeapTypes_s.TUInt128",
"Prims.bool",
"Vale.X64.Memory.load_mem",
"Vale.Def.Types_s.quad32"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union
let loc_buffer #t b = M.loc_buffer b.bsrc
let loc_disjoint = M.loc_disjoint
let loc_includes = M.loc_includes
let modifies s h h' =
M.modifies s (_ih h).hs (_ih h').hs /\
h.heapletId == h'.heapletId /\
(_ih h).ptrs == (_ih h').ptrs /\
(_ih h).addrs == (_ih h').addrs /\
HST.equal_domains (_ih h).hs (_ih h').hs
let buffer_addr #t b h = IB.addrs_of_mem (_ih h) b
open FStar.Mul
#set-options "--z3rlimit 20"
let index64_heap_aux (s:Seq.lseq UInt8.t 8) (heap:S.machine_heap) (ptr:int) : Lemma
(requires forall (j:nat{j < 8}). UInt8.v (Seq.index s j) == heap.[ptr+j])
(ensures UInt64.v (Vale.Interop.Views.get64 s) == S.get_heap_val64 ptr heap) =
let open Vale.Def.Words.Seq_s in
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
Vale.Interop.Views.get64_reveal ();
S.get_heap_val64_reveal ();
Vale.Def.Types_s.le_bytes_to_nat64_reveal ()
let index_helper (x y:int) (heap:S.machine_heap) : Lemma
(requires x == y)
(ensures heap.[x] == heap.[y])
=
()
let index_mul_helper (addr i n j:int) : Lemma
(addr + (i * n + j) == addr + n * i + j) =
()
#set-options "--max_fuel 0 --max_ifuel 0"
let index64_get_heap_val64
(h:vale_heap)
(b:buffer64{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma (Seq.index (buffer_as_seq h b) i == S.get_heap_val64 (buffer_addr b h + scale8 i) heap)
=
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db uint64_view in
let ptr = buffer_addr b h + scale8 i in
let s = DV.as_seq (_ih h).hs db in
let t = TUInt64 in
let addr = buffer_addr b h in
UV.length_eq ub;
UV.as_seq_sel (_ih h).hs ub i;
UV.get_sel (_ih h).hs ub i;
let s' = Seq.slice s (i*8) (i*8 + 8) in
let aux (j:nat{j < 8}) : Lemma (UInt8.v (Seq.index s' j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*8 + j)) == heap.[addr + (i*8+j)]);
Seq.lemma_index_slice s (i*8) (i*8+8) j;
assert (UInt8.v (Seq.index s' j) == heap.[addr+(i*8+j)]);
index_mul_helper addr i 8 j;
()
in Classical.forall_intro aux;
index64_heap_aux s' heap ptr
#set-options "--z3rlimit 50"
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Four_s
open Vale.Lib.Seqs_s
let index128_get_heap_val128_aux (s:Seq.lseq UInt8.t 16) (ptr:int) (heap:S.machine_heap) : Lemma
(requires (forall (j:nat) . j < 16 ==> UInt8.v (Seq.index s j) == heap.[ptr+j]))
(ensures Vale.Interop.Views.get128 s == Mkfour
(S.get_heap_val32 ptr heap)
(S.get_heap_val32 (ptr+4) heap)
(S.get_heap_val32 (ptr+8) heap)
(S.get_heap_val32 (ptr+12) heap)) =
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
S.get_heap_val32_reveal ();
Vale.Interop.Views.get128_reveal ();
Vale.Def.Types_s.le_bytes_to_quad32_reveal ()
let index128_get_heap_val128
(h:vale_heap)
(b:buffer128{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma
(ensures (
let addr = buffer_addr b h in
Seq.index (buffer_as_seq h b) i ==
Mkfour
(S.get_heap_val32 (addr + scale16 i) heap)
(S.get_heap_val32 (addr + scale16 i+4) heap)
(S.get_heap_val32 (addr + scale16 i+8) heap)
(S.get_heap_val32 (addr + scale16 i +12) heap)
))
=
let db = get_downview b.bsrc in
let vb = UV.mk_buffer db uint128_view in
let ptr = buffer_addr b h + scale16 i in
let s = DV.as_seq (_ih h).hs db in
let addr = buffer_addr b h in
UV.length_eq vb;
UV.as_seq_sel (_ih h).hs vb i;
UV.get_sel (_ih h).hs vb i;
let sl = Seq.slice s (i*16) (i*16+16) in
let aux (j:nat{j < 16}) : Lemma (UInt8.v (Seq.index sl j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*16 + j)) == heap.[addr + (i*16+j)]);
Seq.lemma_index_slice s (i*16) (i*16+16) j;
assert (UInt8.v (Seq.index sl j) == heap.[addr+(i*16+j)]);
index_mul_helper addr i 16 j
in Classical.forall_intro aux;
index128_get_heap_val128_aux sl ptr heap
let modifies_goal_directed s h1 h2 = modifies s h1 h2
let lemma_modifies_goal_directed s h1 h2 = ()
let buffer_length_buffer_as_seq #t h b = ()
let same_underlying_seq (#t:base_typ) (h1 h2:vale_heap) (b:buffer t) : Lemma
(requires Seq.equal (DV.as_seq (_ih h1).hs (get_downview b.bsrc)) (DV.as_seq (_ih h2).hs (get_downview b.bsrc)))
(ensures Seq.equal (buffer_as_seq h1 b) (buffer_as_seq h2 b))
=
let db = get_downview b.bsrc in
let rec aux (i:nat{i <= buffer_length b}) : Lemma
(requires (forall (j:nat{j < i}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j) /\
(Seq.equal (DV.as_seq (_ih h1).hs db) (DV.as_seq (_ih h2).hs db)))
(ensures (forall (j:nat{j < buffer_length b}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j))
(decreases %[(buffer_length b) - i]) =
if i = buffer_length b then ()
else (
let bv = UV.mk_buffer db (uint_view t) in
UV.get_sel (_ih h1).hs bv i;
UV.get_sel (_ih h2).hs bv i;
UV.as_seq_sel (_ih h1).hs bv i;
UV.as_seq_sel (_ih h2).hs bv i;
aux (i+1)
)
in aux 0
let modifies_buffer_elim #t1 b p h h' =
let db = get_downview b.bsrc in
lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;
same_underlying_seq h h' b;
assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))
let modifies_buffer_addr #t b p h h' = ()
let modifies_buffer_readable #t b p h h' = ()
let loc_disjoint_none_r s = M.loc_disjoint_none_r s
let loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2
let loc_includes_refl s = M.loc_includes_refl s
let loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3
let loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2
let loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s
let loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)
let loc_includes_none s = M.loc_includes_none s
let modifies_refl s h = M.modifies_refl s (_ih h).hs
let modifies_goal_directed_refl s h = M.modifies_refl s (_ih h).hs
let modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2
let modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs
let modifies_goal_directed_trans s12 h1 h2 s13 h3 =
modifies_trans s12 h1 h2 s13 h3;
modifies_loc_includes s13 h1 h3 (loc_union s12 s13);
()
let modifies_goal_directed_trans2 s12 h1 h2 s13 h3 = modifies_goal_directed_trans s12 h1 h2 s13 h3
let default_of_typ (t:base_typ) : base_typ_as_vale_type t =
allow_inversion base_typ;
match t with
| TUInt8 -> 0
| TUInt16 -> 0
| TUInt32 -> 0
| TUInt64 -> 0
| TUInt128 -> Vale.Def.Words_s.Mkfour #nat32 0 0 0 0
let buffer_read #t b i h =
if i < 0 || i >= buffer_length b then default_of_typ t else
Seq.index (buffer_as_seq h b) i
let seq_upd
(#b:_)
(h:HS.mem)
(vb:UV.buffer b{UV.live h vb})
(i:nat{i < UV.length vb})
(x:b)
: Lemma
(Seq.equal
(Seq.upd (UV.as_seq h vb) i x)
(UV.as_seq (UV.upd h vb i x) vb))
=
let old_s = UV.as_seq h vb in
let new_s = UV.as_seq (UV.upd h vb i x) vb in
let upd_s = Seq.upd old_s i x in
let rec aux (k:nat) : Lemma
(requires (k <= Seq.length upd_s /\ (forall (j:nat). j < k ==> Seq.index upd_s j == Seq.index new_s j)))
(ensures (forall (j:nat). j < Seq.length upd_s ==> Seq.index upd_s j == Seq.index new_s j))
(decreases %[(Seq.length upd_s) - k]) =
if k = Seq.length upd_s then ()
else begin
UV.sel_upd vb i k x h;
UV.as_seq_sel h vb k;
UV.as_seq_sel (UV.upd h vb i x) vb k;
aux (k+1)
end
in aux 0
let buffer_write #t b i v h =
if i < 0 || i >= buffer_length b then h else
begin
let view = uint_view t in
let db = get_downview b.bsrc in
let bv = UV.mk_buffer db view in
UV.upd_modifies (_ih h).hs bv i (v_of_typ t v);
UV.upd_equal_domains (_ih h).hs bv i (v_of_typ t v);
let hs' = UV.upd (_ih h).hs bv i (v_of_typ t v) in
let ih' = InteropHeap (_ih h).ptrs (_ih h).addrs hs' in
let mh' = Vale.Interop.down_mem ih' in
let h':vale_heap = ValeHeap mh' (Ghost.hide ih') h.heapletId in
seq_upd (_ih h).hs bv i (v_of_typ t v);
assert (Seq.equal (buffer_as_seq h' b) (Seq.upd (buffer_as_seq h b) i v));
h'
end
unfold let scale_t (t:base_typ) (index:int) : int = scale_by (view_n t) index
// Checks if address addr corresponds to one of the elements of buffer ptr
let addr_in_ptr (#t:base_typ) (addr:int) (ptr:buffer t) (h:vale_heap) : Ghost bool
(requires True)
(ensures fun b -> not b <==>
(forall (i:int).{:pattern (scale_t t i)} 0 <= i /\ i < buffer_length ptr ==>
addr <> (buffer_addr ptr h) + scale_t t i))
=
let n = buffer_length ptr in
let base = buffer_addr ptr h in
let rec aux (i:nat) : Tot (b:bool{not b <==> (forall j. i <= j /\ j < n ==>
addr <> base + scale_t t j)})
(decreases %[n-i]) =
if i >= n then false
else if addr = base + scale_t t i then true
else aux (i+1)
in aux 0
let valid_offset (t:base_typ) (n base:nat) (addr:int) (i:nat) =
exists j.{:pattern (scale_t t j)} i <= j /\ j < n /\ base + scale_t t j == addr
let rec get_addr_in_ptr (t:base_typ) (n base addr:nat) (i:nat) : Ghost nat
(requires valid_offset t n base addr i)
(ensures fun j -> base + scale_t t j == addr)
(decreases %[n - i])
=
if base + scale_t t i = addr then i
else get_addr_in_ptr t n base addr (i + 1)
let valid_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
DV.length (get_downview b.bsrc) % (view_n t) = 0 &&
addr_in_ptr #t addr b h
let writeable_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
valid_buffer t addr b h && b.writeable
#set-options "--max_fuel 1 --max_ifuel 1"
let sub_list (p1 p2:list 'a) = forall x. {:pattern List.memP x p2} List.memP x p1 ==> List.memP x p2
let rec valid_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b ->
b <==> (exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h)}
List.memP x ps /\ valid_buffer t addr x h))
=
match ps with
| [] -> false
| a::q -> valid_buffer t addr a h || valid_mem_aux t addr q h
let valid_mem (t:base_typ) addr (h:vale_heap) = valid_mem_aux t addr (_ih h).ptrs h
let valid_mem64 ptr h = valid_mem (TUInt64) ptr h
let rec find_valid_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o ->
match o with
| None -> not (valid_mem_aux t addr ps h)
| Some a -> valid_buffer t addr a h /\ List.memP a ps)
=
match ps with
| [] -> None
| a::q -> if valid_buffer t addr a h then Some a else find_valid_buffer_aux t addr q h
let find_valid_buffer (t:base_typ) (addr:int) (h:vale_heap) = find_valid_buffer_aux t addr (_ih h).ptrs h
let rec find_valid_buffer_aux_ps (t:base_typ) (addr:int) (ps:list b8) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs /\ sub_list ps (_ih h1).ptrs)
(ensures find_valid_buffer_aux t addr ps h1 == find_valid_buffer_aux t addr ps h2)
=
match ps with
| [] -> ()
| a::q -> find_valid_buffer_aux_ps t addr q h1 h2
let find_valid_buffer_ps (t:base_typ) (addr:int) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs)
(ensures find_valid_buffer t addr h1 == find_valid_buffer t addr h2)
=
find_valid_buffer_aux_ps t addr (_ih h1).ptrs h1 h2
let find_valid_buffer_valid_offset (t:base_typ) (addr:int) (h:vale_heap) : Lemma
(ensures (
match find_valid_buffer t addr h with
| None -> True
| Some a ->
let base = buffer_addr a h in
valid_offset t (buffer_length a) base addr 0
))
=
()
let rec writeable_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b -> b <==>
(exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h) \/ buffer_writeable x}
List.memP x ps /\ valid_buffer t addr x h /\ buffer_writeable x))
=
match ps with
| [] -> false
| a::q -> writeable_buffer t addr a h || writeable_mem_aux t addr q h
let writeable_mem (t:base_typ) addr (h:vale_heap) = writeable_mem_aux t addr (_ih h).ptrs h
let writeable_mem64 ptr h = writeable_mem (TUInt64) ptr h
let rec find_writeable_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o -> (
match o with
| None -> not (writeable_mem_aux t addr ps h)
| Some a -> writeable_buffer t addr a h /\ List.memP a ps
))
=
match ps with
| [] -> None
| a::q -> if writeable_buffer t addr a h then Some a else find_writeable_buffer_aux t addr q h
let find_writeable_buffer (t:base_typ) (addr:int) (h:vale_heap) =
find_writeable_buffer_aux t addr (_ih h).ptrs h
let load_mem (t:base_typ) (addr:int) (h:vale_heap) : GTot (base_typ_as_vale_type t) =
match find_valid_buffer t addr h with
| None -> default_of_typ t
| Some a ->
let base = buffer_addr a h in
buffer_read a (get_addr_in_ptr t (buffer_length a) base addr 0) h
let load_mem64 ptr h =
if not (valid_mem64 ptr h) then 0
else load_mem (TUInt64) ptr h
let length_t_eq (t:base_typ) (b:buffer t) :
Lemma (DV.length (get_downview b.bsrc) == buffer_length b * (view_n t)) =
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db (uint_view t) in
UV.length_eq ub;
assert (buffer_length b == DV.length db / (view_n t));
FStar.Math.Lib.lemma_div_def (DV.length db) (view_n t)
let get_addr_ptr (t:base_typ) (ptr:int) (h:vale_heap) : Ghost (buffer t)
(requires valid_mem t ptr h)
(ensures fun b -> List.memP b (_ih h).ptrs /\ valid_buffer t ptr b h)
=
Some?.v (find_valid_buffer t ptr h)
#reset-options "--max_fuel 0 --max_ifuel 0 --initial_fuel 0 --initial_ifuel 0 --z3rlimit 20"
let load_buffer_read (t:base_typ) (ptr:int) (h:vale_heap) : Lemma
(requires valid_mem t ptr h)
(ensures (
let b = get_addr_ptr t ptr h in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
load_mem t ptr h == buffer_read #t b i h
))
=
()
let store_mem (t:base_typ) (addr:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires True)
(ensures fun h1 -> (_ih h).addrs == (_ih h1).addrs /\ (_ih h).ptrs == (_ih h1).ptrs)
=
match find_writeable_buffer t addr h with
| None -> h
| Some a ->
let base = buffer_addr a h in
buffer_write a (get_addr_in_ptr t (buffer_length a) base addr 0) v h
let store_mem64 i v h =
if not (valid_mem64 i h) then h
else store_mem (TUInt64) i v h
let store_buffer_write
(t:base_typ)
(ptr:int)
(v:base_typ_as_vale_type t)
(h:vale_heap{writeable_mem t ptr h})
: Lemma
(ensures (
let b = Some?.v (find_writeable_buffer t ptr h) in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
store_mem t ptr v h == buffer_write b i v h
))
=
()
let valid_mem128 ptr h = valid_mem_aux (TUInt128) ptr (_ih h).ptrs h
let writeable_mem128 ptr h = writeable_mem_aux (TUInt128) ptr (_ih h).ptrs h | false | false | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": 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": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32 | [] | Vale.X64.Memory.load_mem128 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> h: Vale.Arch.HeapImpl.vale_heap -> Prims.GTot Vale.Def.Types_s.quad32 | {
"end_col": 32,
"end_line": 495,
"start_col": 2,
"start_line": 494
} |
Prims.GTot | val writeable_buffer (t: base_typ) (addr: int) (b: b8) (h: vale_heap) : GTot bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let writeable_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
valid_buffer t addr b h && b.writeable | val writeable_buffer (t: base_typ) (addr: int) (b: b8) (h: vale_heap) : GTot bool
let writeable_buffer (t: base_typ) (addr: int) (b: b8) (h: vale_heap) : GTot bool = | false | null | false | valid_buffer t addr b h && b.writeable | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"sometrivial"
] | [
"Vale.Arch.HeapTypes_s.base_typ",
"Prims.int",
"Vale.X64.Memory.b8",
"Vale.Arch.HeapImpl.vale_heap",
"Prims.op_AmpAmp",
"Vale.X64.Memory.valid_buffer",
"Vale.Interop.Types.__proj__Buffer__item__writeable",
"Prims.bool"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union
let loc_buffer #t b = M.loc_buffer b.bsrc
let loc_disjoint = M.loc_disjoint
let loc_includes = M.loc_includes
let modifies s h h' =
M.modifies s (_ih h).hs (_ih h').hs /\
h.heapletId == h'.heapletId /\
(_ih h).ptrs == (_ih h').ptrs /\
(_ih h).addrs == (_ih h').addrs /\
HST.equal_domains (_ih h).hs (_ih h').hs
let buffer_addr #t b h = IB.addrs_of_mem (_ih h) b
open FStar.Mul
#set-options "--z3rlimit 20"
let index64_heap_aux (s:Seq.lseq UInt8.t 8) (heap:S.machine_heap) (ptr:int) : Lemma
(requires forall (j:nat{j < 8}). UInt8.v (Seq.index s j) == heap.[ptr+j])
(ensures UInt64.v (Vale.Interop.Views.get64 s) == S.get_heap_val64 ptr heap) =
let open Vale.Def.Words.Seq_s in
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
Vale.Interop.Views.get64_reveal ();
S.get_heap_val64_reveal ();
Vale.Def.Types_s.le_bytes_to_nat64_reveal ()
let index_helper (x y:int) (heap:S.machine_heap) : Lemma
(requires x == y)
(ensures heap.[x] == heap.[y])
=
()
let index_mul_helper (addr i n j:int) : Lemma
(addr + (i * n + j) == addr + n * i + j) =
()
#set-options "--max_fuel 0 --max_ifuel 0"
let index64_get_heap_val64
(h:vale_heap)
(b:buffer64{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma (Seq.index (buffer_as_seq h b) i == S.get_heap_val64 (buffer_addr b h + scale8 i) heap)
=
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db uint64_view in
let ptr = buffer_addr b h + scale8 i in
let s = DV.as_seq (_ih h).hs db in
let t = TUInt64 in
let addr = buffer_addr b h in
UV.length_eq ub;
UV.as_seq_sel (_ih h).hs ub i;
UV.get_sel (_ih h).hs ub i;
let s' = Seq.slice s (i*8) (i*8 + 8) in
let aux (j:nat{j < 8}) : Lemma (UInt8.v (Seq.index s' j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*8 + j)) == heap.[addr + (i*8+j)]);
Seq.lemma_index_slice s (i*8) (i*8+8) j;
assert (UInt8.v (Seq.index s' j) == heap.[addr+(i*8+j)]);
index_mul_helper addr i 8 j;
()
in Classical.forall_intro aux;
index64_heap_aux s' heap ptr
#set-options "--z3rlimit 50"
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Four_s
open Vale.Lib.Seqs_s
let index128_get_heap_val128_aux (s:Seq.lseq UInt8.t 16) (ptr:int) (heap:S.machine_heap) : Lemma
(requires (forall (j:nat) . j < 16 ==> UInt8.v (Seq.index s j) == heap.[ptr+j]))
(ensures Vale.Interop.Views.get128 s == Mkfour
(S.get_heap_val32 ptr heap)
(S.get_heap_val32 (ptr+4) heap)
(S.get_heap_val32 (ptr+8) heap)
(S.get_heap_val32 (ptr+12) heap)) =
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
S.get_heap_val32_reveal ();
Vale.Interop.Views.get128_reveal ();
Vale.Def.Types_s.le_bytes_to_quad32_reveal ()
let index128_get_heap_val128
(h:vale_heap)
(b:buffer128{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma
(ensures (
let addr = buffer_addr b h in
Seq.index (buffer_as_seq h b) i ==
Mkfour
(S.get_heap_val32 (addr + scale16 i) heap)
(S.get_heap_val32 (addr + scale16 i+4) heap)
(S.get_heap_val32 (addr + scale16 i+8) heap)
(S.get_heap_val32 (addr + scale16 i +12) heap)
))
=
let db = get_downview b.bsrc in
let vb = UV.mk_buffer db uint128_view in
let ptr = buffer_addr b h + scale16 i in
let s = DV.as_seq (_ih h).hs db in
let addr = buffer_addr b h in
UV.length_eq vb;
UV.as_seq_sel (_ih h).hs vb i;
UV.get_sel (_ih h).hs vb i;
let sl = Seq.slice s (i*16) (i*16+16) in
let aux (j:nat{j < 16}) : Lemma (UInt8.v (Seq.index sl j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*16 + j)) == heap.[addr + (i*16+j)]);
Seq.lemma_index_slice s (i*16) (i*16+16) j;
assert (UInt8.v (Seq.index sl j) == heap.[addr+(i*16+j)]);
index_mul_helper addr i 16 j
in Classical.forall_intro aux;
index128_get_heap_val128_aux sl ptr heap
let modifies_goal_directed s h1 h2 = modifies s h1 h2
let lemma_modifies_goal_directed s h1 h2 = ()
let buffer_length_buffer_as_seq #t h b = ()
let same_underlying_seq (#t:base_typ) (h1 h2:vale_heap) (b:buffer t) : Lemma
(requires Seq.equal (DV.as_seq (_ih h1).hs (get_downview b.bsrc)) (DV.as_seq (_ih h2).hs (get_downview b.bsrc)))
(ensures Seq.equal (buffer_as_seq h1 b) (buffer_as_seq h2 b))
=
let db = get_downview b.bsrc in
let rec aux (i:nat{i <= buffer_length b}) : Lemma
(requires (forall (j:nat{j < i}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j) /\
(Seq.equal (DV.as_seq (_ih h1).hs db) (DV.as_seq (_ih h2).hs db)))
(ensures (forall (j:nat{j < buffer_length b}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j))
(decreases %[(buffer_length b) - i]) =
if i = buffer_length b then ()
else (
let bv = UV.mk_buffer db (uint_view t) in
UV.get_sel (_ih h1).hs bv i;
UV.get_sel (_ih h2).hs bv i;
UV.as_seq_sel (_ih h1).hs bv i;
UV.as_seq_sel (_ih h2).hs bv i;
aux (i+1)
)
in aux 0
let modifies_buffer_elim #t1 b p h h' =
let db = get_downview b.bsrc in
lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;
same_underlying_seq h h' b;
assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))
let modifies_buffer_addr #t b p h h' = ()
let modifies_buffer_readable #t b p h h' = ()
let loc_disjoint_none_r s = M.loc_disjoint_none_r s
let loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2
let loc_includes_refl s = M.loc_includes_refl s
let loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3
let loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2
let loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s
let loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)
let loc_includes_none s = M.loc_includes_none s
let modifies_refl s h = M.modifies_refl s (_ih h).hs
let modifies_goal_directed_refl s h = M.modifies_refl s (_ih h).hs
let modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2
let modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs
let modifies_goal_directed_trans s12 h1 h2 s13 h3 =
modifies_trans s12 h1 h2 s13 h3;
modifies_loc_includes s13 h1 h3 (loc_union s12 s13);
()
let modifies_goal_directed_trans2 s12 h1 h2 s13 h3 = modifies_goal_directed_trans s12 h1 h2 s13 h3
let default_of_typ (t:base_typ) : base_typ_as_vale_type t =
allow_inversion base_typ;
match t with
| TUInt8 -> 0
| TUInt16 -> 0
| TUInt32 -> 0
| TUInt64 -> 0
| TUInt128 -> Vale.Def.Words_s.Mkfour #nat32 0 0 0 0
let buffer_read #t b i h =
if i < 0 || i >= buffer_length b then default_of_typ t else
Seq.index (buffer_as_seq h b) i
let seq_upd
(#b:_)
(h:HS.mem)
(vb:UV.buffer b{UV.live h vb})
(i:nat{i < UV.length vb})
(x:b)
: Lemma
(Seq.equal
(Seq.upd (UV.as_seq h vb) i x)
(UV.as_seq (UV.upd h vb i x) vb))
=
let old_s = UV.as_seq h vb in
let new_s = UV.as_seq (UV.upd h vb i x) vb in
let upd_s = Seq.upd old_s i x in
let rec aux (k:nat) : Lemma
(requires (k <= Seq.length upd_s /\ (forall (j:nat). j < k ==> Seq.index upd_s j == Seq.index new_s j)))
(ensures (forall (j:nat). j < Seq.length upd_s ==> Seq.index upd_s j == Seq.index new_s j))
(decreases %[(Seq.length upd_s) - k]) =
if k = Seq.length upd_s then ()
else begin
UV.sel_upd vb i k x h;
UV.as_seq_sel h vb k;
UV.as_seq_sel (UV.upd h vb i x) vb k;
aux (k+1)
end
in aux 0
let buffer_write #t b i v h =
if i < 0 || i >= buffer_length b then h else
begin
let view = uint_view t in
let db = get_downview b.bsrc in
let bv = UV.mk_buffer db view in
UV.upd_modifies (_ih h).hs bv i (v_of_typ t v);
UV.upd_equal_domains (_ih h).hs bv i (v_of_typ t v);
let hs' = UV.upd (_ih h).hs bv i (v_of_typ t v) in
let ih' = InteropHeap (_ih h).ptrs (_ih h).addrs hs' in
let mh' = Vale.Interop.down_mem ih' in
let h':vale_heap = ValeHeap mh' (Ghost.hide ih') h.heapletId in
seq_upd (_ih h).hs bv i (v_of_typ t v);
assert (Seq.equal (buffer_as_seq h' b) (Seq.upd (buffer_as_seq h b) i v));
h'
end
unfold let scale_t (t:base_typ) (index:int) : int = scale_by (view_n t) index
// Checks if address addr corresponds to one of the elements of buffer ptr
let addr_in_ptr (#t:base_typ) (addr:int) (ptr:buffer t) (h:vale_heap) : Ghost bool
(requires True)
(ensures fun b -> not b <==>
(forall (i:int).{:pattern (scale_t t i)} 0 <= i /\ i < buffer_length ptr ==>
addr <> (buffer_addr ptr h) + scale_t t i))
=
let n = buffer_length ptr in
let base = buffer_addr ptr h in
let rec aux (i:nat) : Tot (b:bool{not b <==> (forall j. i <= j /\ j < n ==>
addr <> base + scale_t t j)})
(decreases %[n-i]) =
if i >= n then false
else if addr = base + scale_t t i then true
else aux (i+1)
in aux 0
let valid_offset (t:base_typ) (n base:nat) (addr:int) (i:nat) =
exists j.{:pattern (scale_t t j)} i <= j /\ j < n /\ base + scale_t t j == addr
let rec get_addr_in_ptr (t:base_typ) (n base addr:nat) (i:nat) : Ghost nat
(requires valid_offset t n base addr i)
(ensures fun j -> base + scale_t t j == addr)
(decreases %[n - i])
=
if base + scale_t t i = addr then i
else get_addr_in_ptr t n base addr (i + 1)
let valid_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
DV.length (get_downview b.bsrc) % (view_n t) = 0 &&
addr_in_ptr #t addr b h | false | false | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": 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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val writeable_buffer (t: base_typ) (addr: int) (b: b8) (h: vale_heap) : GTot bool | [] | Vale.X64.Memory.writeable_buffer | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
t: Vale.Arch.HeapTypes_s.base_typ ->
addr: Prims.int ->
b: Vale.X64.Memory.b8 ->
h: Vale.Arch.HeapImpl.vale_heap
-> Prims.GTot Prims.bool | {
"end_col": 40,
"end_line": 345,
"start_col": 2,
"start_line": 345
} |
Prims.GTot | val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let store_mem64 i v h =
if not (valid_mem64 i h) then h
else store_mem (TUInt64) i v h | val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap
let store_mem64 i v h = | false | null | false | if not (valid_mem64 i h) then h else store_mem (TUInt64) i v h | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.Def.Types_s.nat64",
"Vale.Arch.HeapImpl.vale_heap",
"Prims.op_Negation",
"Vale.X64.Memory.valid_mem64",
"Prims.bool",
"Vale.X64.Memory.store_mem",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union
let loc_buffer #t b = M.loc_buffer b.bsrc
let loc_disjoint = M.loc_disjoint
let loc_includes = M.loc_includes
let modifies s h h' =
M.modifies s (_ih h).hs (_ih h').hs /\
h.heapletId == h'.heapletId /\
(_ih h).ptrs == (_ih h').ptrs /\
(_ih h).addrs == (_ih h').addrs /\
HST.equal_domains (_ih h).hs (_ih h').hs
let buffer_addr #t b h = IB.addrs_of_mem (_ih h) b
open FStar.Mul
#set-options "--z3rlimit 20"
let index64_heap_aux (s:Seq.lseq UInt8.t 8) (heap:S.machine_heap) (ptr:int) : Lemma
(requires forall (j:nat{j < 8}). UInt8.v (Seq.index s j) == heap.[ptr+j])
(ensures UInt64.v (Vale.Interop.Views.get64 s) == S.get_heap_val64 ptr heap) =
let open Vale.Def.Words.Seq_s in
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
Vale.Interop.Views.get64_reveal ();
S.get_heap_val64_reveal ();
Vale.Def.Types_s.le_bytes_to_nat64_reveal ()
let index_helper (x y:int) (heap:S.machine_heap) : Lemma
(requires x == y)
(ensures heap.[x] == heap.[y])
=
()
let index_mul_helper (addr i n j:int) : Lemma
(addr + (i * n + j) == addr + n * i + j) =
()
#set-options "--max_fuel 0 --max_ifuel 0"
let index64_get_heap_val64
(h:vale_heap)
(b:buffer64{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma (Seq.index (buffer_as_seq h b) i == S.get_heap_val64 (buffer_addr b h + scale8 i) heap)
=
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db uint64_view in
let ptr = buffer_addr b h + scale8 i in
let s = DV.as_seq (_ih h).hs db in
let t = TUInt64 in
let addr = buffer_addr b h in
UV.length_eq ub;
UV.as_seq_sel (_ih h).hs ub i;
UV.get_sel (_ih h).hs ub i;
let s' = Seq.slice s (i*8) (i*8 + 8) in
let aux (j:nat{j < 8}) : Lemma (UInt8.v (Seq.index s' j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*8 + j)) == heap.[addr + (i*8+j)]);
Seq.lemma_index_slice s (i*8) (i*8+8) j;
assert (UInt8.v (Seq.index s' j) == heap.[addr+(i*8+j)]);
index_mul_helper addr i 8 j;
()
in Classical.forall_intro aux;
index64_heap_aux s' heap ptr
#set-options "--z3rlimit 50"
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Four_s
open Vale.Lib.Seqs_s
let index128_get_heap_val128_aux (s:Seq.lseq UInt8.t 16) (ptr:int) (heap:S.machine_heap) : Lemma
(requires (forall (j:nat) . j < 16 ==> UInt8.v (Seq.index s j) == heap.[ptr+j]))
(ensures Vale.Interop.Views.get128 s == Mkfour
(S.get_heap_val32 ptr heap)
(S.get_heap_val32 (ptr+4) heap)
(S.get_heap_val32 (ptr+8) heap)
(S.get_heap_val32 (ptr+12) heap)) =
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
S.get_heap_val32_reveal ();
Vale.Interop.Views.get128_reveal ();
Vale.Def.Types_s.le_bytes_to_quad32_reveal ()
let index128_get_heap_val128
(h:vale_heap)
(b:buffer128{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma
(ensures (
let addr = buffer_addr b h in
Seq.index (buffer_as_seq h b) i ==
Mkfour
(S.get_heap_val32 (addr + scale16 i) heap)
(S.get_heap_val32 (addr + scale16 i+4) heap)
(S.get_heap_val32 (addr + scale16 i+8) heap)
(S.get_heap_val32 (addr + scale16 i +12) heap)
))
=
let db = get_downview b.bsrc in
let vb = UV.mk_buffer db uint128_view in
let ptr = buffer_addr b h + scale16 i in
let s = DV.as_seq (_ih h).hs db in
let addr = buffer_addr b h in
UV.length_eq vb;
UV.as_seq_sel (_ih h).hs vb i;
UV.get_sel (_ih h).hs vb i;
let sl = Seq.slice s (i*16) (i*16+16) in
let aux (j:nat{j < 16}) : Lemma (UInt8.v (Seq.index sl j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*16 + j)) == heap.[addr + (i*16+j)]);
Seq.lemma_index_slice s (i*16) (i*16+16) j;
assert (UInt8.v (Seq.index sl j) == heap.[addr+(i*16+j)]);
index_mul_helper addr i 16 j
in Classical.forall_intro aux;
index128_get_heap_val128_aux sl ptr heap
let modifies_goal_directed s h1 h2 = modifies s h1 h2
let lemma_modifies_goal_directed s h1 h2 = ()
let buffer_length_buffer_as_seq #t h b = ()
let same_underlying_seq (#t:base_typ) (h1 h2:vale_heap) (b:buffer t) : Lemma
(requires Seq.equal (DV.as_seq (_ih h1).hs (get_downview b.bsrc)) (DV.as_seq (_ih h2).hs (get_downview b.bsrc)))
(ensures Seq.equal (buffer_as_seq h1 b) (buffer_as_seq h2 b))
=
let db = get_downview b.bsrc in
let rec aux (i:nat{i <= buffer_length b}) : Lemma
(requires (forall (j:nat{j < i}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j) /\
(Seq.equal (DV.as_seq (_ih h1).hs db) (DV.as_seq (_ih h2).hs db)))
(ensures (forall (j:nat{j < buffer_length b}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j))
(decreases %[(buffer_length b) - i]) =
if i = buffer_length b then ()
else (
let bv = UV.mk_buffer db (uint_view t) in
UV.get_sel (_ih h1).hs bv i;
UV.get_sel (_ih h2).hs bv i;
UV.as_seq_sel (_ih h1).hs bv i;
UV.as_seq_sel (_ih h2).hs bv i;
aux (i+1)
)
in aux 0
let modifies_buffer_elim #t1 b p h h' =
let db = get_downview b.bsrc in
lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;
same_underlying_seq h h' b;
assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))
let modifies_buffer_addr #t b p h h' = ()
let modifies_buffer_readable #t b p h h' = ()
let loc_disjoint_none_r s = M.loc_disjoint_none_r s
let loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2
let loc_includes_refl s = M.loc_includes_refl s
let loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3
let loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2
let loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s
let loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)
let loc_includes_none s = M.loc_includes_none s
let modifies_refl s h = M.modifies_refl s (_ih h).hs
let modifies_goal_directed_refl s h = M.modifies_refl s (_ih h).hs
let modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2
let modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs
let modifies_goal_directed_trans s12 h1 h2 s13 h3 =
modifies_trans s12 h1 h2 s13 h3;
modifies_loc_includes s13 h1 h3 (loc_union s12 s13);
()
let modifies_goal_directed_trans2 s12 h1 h2 s13 h3 = modifies_goal_directed_trans s12 h1 h2 s13 h3
let default_of_typ (t:base_typ) : base_typ_as_vale_type t =
allow_inversion base_typ;
match t with
| TUInt8 -> 0
| TUInt16 -> 0
| TUInt32 -> 0
| TUInt64 -> 0
| TUInt128 -> Vale.Def.Words_s.Mkfour #nat32 0 0 0 0
let buffer_read #t b i h =
if i < 0 || i >= buffer_length b then default_of_typ t else
Seq.index (buffer_as_seq h b) i
let seq_upd
(#b:_)
(h:HS.mem)
(vb:UV.buffer b{UV.live h vb})
(i:nat{i < UV.length vb})
(x:b)
: Lemma
(Seq.equal
(Seq.upd (UV.as_seq h vb) i x)
(UV.as_seq (UV.upd h vb i x) vb))
=
let old_s = UV.as_seq h vb in
let new_s = UV.as_seq (UV.upd h vb i x) vb in
let upd_s = Seq.upd old_s i x in
let rec aux (k:nat) : Lemma
(requires (k <= Seq.length upd_s /\ (forall (j:nat). j < k ==> Seq.index upd_s j == Seq.index new_s j)))
(ensures (forall (j:nat). j < Seq.length upd_s ==> Seq.index upd_s j == Seq.index new_s j))
(decreases %[(Seq.length upd_s) - k]) =
if k = Seq.length upd_s then ()
else begin
UV.sel_upd vb i k x h;
UV.as_seq_sel h vb k;
UV.as_seq_sel (UV.upd h vb i x) vb k;
aux (k+1)
end
in aux 0
let buffer_write #t b i v h =
if i < 0 || i >= buffer_length b then h else
begin
let view = uint_view t in
let db = get_downview b.bsrc in
let bv = UV.mk_buffer db view in
UV.upd_modifies (_ih h).hs bv i (v_of_typ t v);
UV.upd_equal_domains (_ih h).hs bv i (v_of_typ t v);
let hs' = UV.upd (_ih h).hs bv i (v_of_typ t v) in
let ih' = InteropHeap (_ih h).ptrs (_ih h).addrs hs' in
let mh' = Vale.Interop.down_mem ih' in
let h':vale_heap = ValeHeap mh' (Ghost.hide ih') h.heapletId in
seq_upd (_ih h).hs bv i (v_of_typ t v);
assert (Seq.equal (buffer_as_seq h' b) (Seq.upd (buffer_as_seq h b) i v));
h'
end
unfold let scale_t (t:base_typ) (index:int) : int = scale_by (view_n t) index
// Checks if address addr corresponds to one of the elements of buffer ptr
let addr_in_ptr (#t:base_typ) (addr:int) (ptr:buffer t) (h:vale_heap) : Ghost bool
(requires True)
(ensures fun b -> not b <==>
(forall (i:int).{:pattern (scale_t t i)} 0 <= i /\ i < buffer_length ptr ==>
addr <> (buffer_addr ptr h) + scale_t t i))
=
let n = buffer_length ptr in
let base = buffer_addr ptr h in
let rec aux (i:nat) : Tot (b:bool{not b <==> (forall j. i <= j /\ j < n ==>
addr <> base + scale_t t j)})
(decreases %[n-i]) =
if i >= n then false
else if addr = base + scale_t t i then true
else aux (i+1)
in aux 0
let valid_offset (t:base_typ) (n base:nat) (addr:int) (i:nat) =
exists j.{:pattern (scale_t t j)} i <= j /\ j < n /\ base + scale_t t j == addr
let rec get_addr_in_ptr (t:base_typ) (n base addr:nat) (i:nat) : Ghost nat
(requires valid_offset t n base addr i)
(ensures fun j -> base + scale_t t j == addr)
(decreases %[n - i])
=
if base + scale_t t i = addr then i
else get_addr_in_ptr t n base addr (i + 1)
let valid_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
DV.length (get_downview b.bsrc) % (view_n t) = 0 &&
addr_in_ptr #t addr b h
let writeable_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
valid_buffer t addr b h && b.writeable
#set-options "--max_fuel 1 --max_ifuel 1"
let sub_list (p1 p2:list 'a) = forall x. {:pattern List.memP x p2} List.memP x p1 ==> List.memP x p2
let rec valid_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b ->
b <==> (exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h)}
List.memP x ps /\ valid_buffer t addr x h))
=
match ps with
| [] -> false
| a::q -> valid_buffer t addr a h || valid_mem_aux t addr q h
let valid_mem (t:base_typ) addr (h:vale_heap) = valid_mem_aux t addr (_ih h).ptrs h
let valid_mem64 ptr h = valid_mem (TUInt64) ptr h
let rec find_valid_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o ->
match o with
| None -> not (valid_mem_aux t addr ps h)
| Some a -> valid_buffer t addr a h /\ List.memP a ps)
=
match ps with
| [] -> None
| a::q -> if valid_buffer t addr a h then Some a else find_valid_buffer_aux t addr q h
let find_valid_buffer (t:base_typ) (addr:int) (h:vale_heap) = find_valid_buffer_aux t addr (_ih h).ptrs h
let rec find_valid_buffer_aux_ps (t:base_typ) (addr:int) (ps:list b8) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs /\ sub_list ps (_ih h1).ptrs)
(ensures find_valid_buffer_aux t addr ps h1 == find_valid_buffer_aux t addr ps h2)
=
match ps with
| [] -> ()
| a::q -> find_valid_buffer_aux_ps t addr q h1 h2
let find_valid_buffer_ps (t:base_typ) (addr:int) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs)
(ensures find_valid_buffer t addr h1 == find_valid_buffer t addr h2)
=
find_valid_buffer_aux_ps t addr (_ih h1).ptrs h1 h2
let find_valid_buffer_valid_offset (t:base_typ) (addr:int) (h:vale_heap) : Lemma
(ensures (
match find_valid_buffer t addr h with
| None -> True
| Some a ->
let base = buffer_addr a h in
valid_offset t (buffer_length a) base addr 0
))
=
()
let rec writeable_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b -> b <==>
(exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h) \/ buffer_writeable x}
List.memP x ps /\ valid_buffer t addr x h /\ buffer_writeable x))
=
match ps with
| [] -> false
| a::q -> writeable_buffer t addr a h || writeable_mem_aux t addr q h
let writeable_mem (t:base_typ) addr (h:vale_heap) = writeable_mem_aux t addr (_ih h).ptrs h
let writeable_mem64 ptr h = writeable_mem (TUInt64) ptr h
let rec find_writeable_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o -> (
match o with
| None -> not (writeable_mem_aux t addr ps h)
| Some a -> writeable_buffer t addr a h /\ List.memP a ps
))
=
match ps with
| [] -> None
| a::q -> if writeable_buffer t addr a h then Some a else find_writeable_buffer_aux t addr q h
let find_writeable_buffer (t:base_typ) (addr:int) (h:vale_heap) =
find_writeable_buffer_aux t addr (_ih h).ptrs h
let load_mem (t:base_typ) (addr:int) (h:vale_heap) : GTot (base_typ_as_vale_type t) =
match find_valid_buffer t addr h with
| None -> default_of_typ t
| Some a ->
let base = buffer_addr a h in
buffer_read a (get_addr_in_ptr t (buffer_length a) base addr 0) h
let load_mem64 ptr h =
if not (valid_mem64 ptr h) then 0
else load_mem (TUInt64) ptr h
let length_t_eq (t:base_typ) (b:buffer t) :
Lemma (DV.length (get_downview b.bsrc) == buffer_length b * (view_n t)) =
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db (uint_view t) in
UV.length_eq ub;
assert (buffer_length b == DV.length db / (view_n t));
FStar.Math.Lib.lemma_div_def (DV.length db) (view_n t)
let get_addr_ptr (t:base_typ) (ptr:int) (h:vale_heap) : Ghost (buffer t)
(requires valid_mem t ptr h)
(ensures fun b -> List.memP b (_ih h).ptrs /\ valid_buffer t ptr b h)
=
Some?.v (find_valid_buffer t ptr h)
#reset-options "--max_fuel 0 --max_ifuel 0 --initial_fuel 0 --initial_ifuel 0 --z3rlimit 20"
let load_buffer_read (t:base_typ) (ptr:int) (h:vale_heap) : Lemma
(requires valid_mem t ptr h)
(ensures (
let b = get_addr_ptr t ptr h in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
load_mem t ptr h == buffer_read #t b i h
))
=
()
let store_mem (t:base_typ) (addr:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires True)
(ensures fun h1 -> (_ih h).addrs == (_ih h1).addrs /\ (_ih h).ptrs == (_ih h1).ptrs)
=
match find_writeable_buffer t addr h with
| None -> h
| Some a ->
let base = buffer_addr a h in
buffer_write a (get_addr_in_ptr t (buffer_length a) base addr 0) v h | false | false | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": 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": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap | [] | Vale.X64.Memory.store_mem64 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.Def.Types_s.nat64 -> h: Vale.Arch.HeapImpl.vale_heap
-> Prims.GTot Vale.Arch.HeapImpl.vale_heap | {
"end_col": 32,
"end_line": 475,
"start_col": 2,
"start_line": 474
} |
Prims.GTot | val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let store_mem128 ptr v h =
if not (valid_mem128 ptr h) then h
else store_mem (TUInt128) ptr v h | val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap
let store_mem128 ptr v h = | false | null | false | if not (valid_mem128 ptr h) then h else store_mem (TUInt128) ptr v h | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.Def.Types_s.quad32",
"Vale.Arch.HeapImpl.vale_heap",
"Prims.op_Negation",
"Vale.X64.Memory.valid_mem128",
"Prims.bool",
"Vale.X64.Memory.store_mem",
"Vale.Arch.HeapTypes_s.TUInt128"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union
let loc_buffer #t b = M.loc_buffer b.bsrc
let loc_disjoint = M.loc_disjoint
let loc_includes = M.loc_includes
let modifies s h h' =
M.modifies s (_ih h).hs (_ih h').hs /\
h.heapletId == h'.heapletId /\
(_ih h).ptrs == (_ih h').ptrs /\
(_ih h).addrs == (_ih h').addrs /\
HST.equal_domains (_ih h).hs (_ih h').hs
let buffer_addr #t b h = IB.addrs_of_mem (_ih h) b
open FStar.Mul
#set-options "--z3rlimit 20"
let index64_heap_aux (s:Seq.lseq UInt8.t 8) (heap:S.machine_heap) (ptr:int) : Lemma
(requires forall (j:nat{j < 8}). UInt8.v (Seq.index s j) == heap.[ptr+j])
(ensures UInt64.v (Vale.Interop.Views.get64 s) == S.get_heap_val64 ptr heap) =
let open Vale.Def.Words.Seq_s in
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
Vale.Interop.Views.get64_reveal ();
S.get_heap_val64_reveal ();
Vale.Def.Types_s.le_bytes_to_nat64_reveal ()
let index_helper (x y:int) (heap:S.machine_heap) : Lemma
(requires x == y)
(ensures heap.[x] == heap.[y])
=
()
let index_mul_helper (addr i n j:int) : Lemma
(addr + (i * n + j) == addr + n * i + j) =
()
#set-options "--max_fuel 0 --max_ifuel 0"
let index64_get_heap_val64
(h:vale_heap)
(b:buffer64{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma (Seq.index (buffer_as_seq h b) i == S.get_heap_val64 (buffer_addr b h + scale8 i) heap)
=
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db uint64_view in
let ptr = buffer_addr b h + scale8 i in
let s = DV.as_seq (_ih h).hs db in
let t = TUInt64 in
let addr = buffer_addr b h in
UV.length_eq ub;
UV.as_seq_sel (_ih h).hs ub i;
UV.get_sel (_ih h).hs ub i;
let s' = Seq.slice s (i*8) (i*8 + 8) in
let aux (j:nat{j < 8}) : Lemma (UInt8.v (Seq.index s' j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*8 + j)) == heap.[addr + (i*8+j)]);
Seq.lemma_index_slice s (i*8) (i*8+8) j;
assert (UInt8.v (Seq.index s' j) == heap.[addr+(i*8+j)]);
index_mul_helper addr i 8 j;
()
in Classical.forall_intro aux;
index64_heap_aux s' heap ptr
#set-options "--z3rlimit 50"
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Four_s
open Vale.Lib.Seqs_s
let index128_get_heap_val128_aux (s:Seq.lseq UInt8.t 16) (ptr:int) (heap:S.machine_heap) : Lemma
(requires (forall (j:nat) . j < 16 ==> UInt8.v (Seq.index s j) == heap.[ptr+j]))
(ensures Vale.Interop.Views.get128 s == Mkfour
(S.get_heap_val32 ptr heap)
(S.get_heap_val32 (ptr+4) heap)
(S.get_heap_val32 (ptr+8) heap)
(S.get_heap_val32 (ptr+12) heap)) =
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
S.get_heap_val32_reveal ();
Vale.Interop.Views.get128_reveal ();
Vale.Def.Types_s.le_bytes_to_quad32_reveal ()
let index128_get_heap_val128
(h:vale_heap)
(b:buffer128{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma
(ensures (
let addr = buffer_addr b h in
Seq.index (buffer_as_seq h b) i ==
Mkfour
(S.get_heap_val32 (addr + scale16 i) heap)
(S.get_heap_val32 (addr + scale16 i+4) heap)
(S.get_heap_val32 (addr + scale16 i+8) heap)
(S.get_heap_val32 (addr + scale16 i +12) heap)
))
=
let db = get_downview b.bsrc in
let vb = UV.mk_buffer db uint128_view in
let ptr = buffer_addr b h + scale16 i in
let s = DV.as_seq (_ih h).hs db in
let addr = buffer_addr b h in
UV.length_eq vb;
UV.as_seq_sel (_ih h).hs vb i;
UV.get_sel (_ih h).hs vb i;
let sl = Seq.slice s (i*16) (i*16+16) in
let aux (j:nat{j < 16}) : Lemma (UInt8.v (Seq.index sl j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*16 + j)) == heap.[addr + (i*16+j)]);
Seq.lemma_index_slice s (i*16) (i*16+16) j;
assert (UInt8.v (Seq.index sl j) == heap.[addr+(i*16+j)]);
index_mul_helper addr i 16 j
in Classical.forall_intro aux;
index128_get_heap_val128_aux sl ptr heap
let modifies_goal_directed s h1 h2 = modifies s h1 h2
let lemma_modifies_goal_directed s h1 h2 = ()
let buffer_length_buffer_as_seq #t h b = ()
let same_underlying_seq (#t:base_typ) (h1 h2:vale_heap) (b:buffer t) : Lemma
(requires Seq.equal (DV.as_seq (_ih h1).hs (get_downview b.bsrc)) (DV.as_seq (_ih h2).hs (get_downview b.bsrc)))
(ensures Seq.equal (buffer_as_seq h1 b) (buffer_as_seq h2 b))
=
let db = get_downview b.bsrc in
let rec aux (i:nat{i <= buffer_length b}) : Lemma
(requires (forall (j:nat{j < i}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j) /\
(Seq.equal (DV.as_seq (_ih h1).hs db) (DV.as_seq (_ih h2).hs db)))
(ensures (forall (j:nat{j < buffer_length b}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j))
(decreases %[(buffer_length b) - i]) =
if i = buffer_length b then ()
else (
let bv = UV.mk_buffer db (uint_view t) in
UV.get_sel (_ih h1).hs bv i;
UV.get_sel (_ih h2).hs bv i;
UV.as_seq_sel (_ih h1).hs bv i;
UV.as_seq_sel (_ih h2).hs bv i;
aux (i+1)
)
in aux 0
let modifies_buffer_elim #t1 b p h h' =
let db = get_downview b.bsrc in
lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;
same_underlying_seq h h' b;
assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))
let modifies_buffer_addr #t b p h h' = ()
let modifies_buffer_readable #t b p h h' = ()
let loc_disjoint_none_r s = M.loc_disjoint_none_r s
let loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2
let loc_includes_refl s = M.loc_includes_refl s
let loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3
let loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2
let loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s
let loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)
let loc_includes_none s = M.loc_includes_none s
let modifies_refl s h = M.modifies_refl s (_ih h).hs
let modifies_goal_directed_refl s h = M.modifies_refl s (_ih h).hs
let modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2
let modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs
let modifies_goal_directed_trans s12 h1 h2 s13 h3 =
modifies_trans s12 h1 h2 s13 h3;
modifies_loc_includes s13 h1 h3 (loc_union s12 s13);
()
let modifies_goal_directed_trans2 s12 h1 h2 s13 h3 = modifies_goal_directed_trans s12 h1 h2 s13 h3
let default_of_typ (t:base_typ) : base_typ_as_vale_type t =
allow_inversion base_typ;
match t with
| TUInt8 -> 0
| TUInt16 -> 0
| TUInt32 -> 0
| TUInt64 -> 0
| TUInt128 -> Vale.Def.Words_s.Mkfour #nat32 0 0 0 0
let buffer_read #t b i h =
if i < 0 || i >= buffer_length b then default_of_typ t else
Seq.index (buffer_as_seq h b) i
let seq_upd
(#b:_)
(h:HS.mem)
(vb:UV.buffer b{UV.live h vb})
(i:nat{i < UV.length vb})
(x:b)
: Lemma
(Seq.equal
(Seq.upd (UV.as_seq h vb) i x)
(UV.as_seq (UV.upd h vb i x) vb))
=
let old_s = UV.as_seq h vb in
let new_s = UV.as_seq (UV.upd h vb i x) vb in
let upd_s = Seq.upd old_s i x in
let rec aux (k:nat) : Lemma
(requires (k <= Seq.length upd_s /\ (forall (j:nat). j < k ==> Seq.index upd_s j == Seq.index new_s j)))
(ensures (forall (j:nat). j < Seq.length upd_s ==> Seq.index upd_s j == Seq.index new_s j))
(decreases %[(Seq.length upd_s) - k]) =
if k = Seq.length upd_s then ()
else begin
UV.sel_upd vb i k x h;
UV.as_seq_sel h vb k;
UV.as_seq_sel (UV.upd h vb i x) vb k;
aux (k+1)
end
in aux 0
let buffer_write #t b i v h =
if i < 0 || i >= buffer_length b then h else
begin
let view = uint_view t in
let db = get_downview b.bsrc in
let bv = UV.mk_buffer db view in
UV.upd_modifies (_ih h).hs bv i (v_of_typ t v);
UV.upd_equal_domains (_ih h).hs bv i (v_of_typ t v);
let hs' = UV.upd (_ih h).hs bv i (v_of_typ t v) in
let ih' = InteropHeap (_ih h).ptrs (_ih h).addrs hs' in
let mh' = Vale.Interop.down_mem ih' in
let h':vale_heap = ValeHeap mh' (Ghost.hide ih') h.heapletId in
seq_upd (_ih h).hs bv i (v_of_typ t v);
assert (Seq.equal (buffer_as_seq h' b) (Seq.upd (buffer_as_seq h b) i v));
h'
end
unfold let scale_t (t:base_typ) (index:int) : int = scale_by (view_n t) index
// Checks if address addr corresponds to one of the elements of buffer ptr
let addr_in_ptr (#t:base_typ) (addr:int) (ptr:buffer t) (h:vale_heap) : Ghost bool
(requires True)
(ensures fun b -> not b <==>
(forall (i:int).{:pattern (scale_t t i)} 0 <= i /\ i < buffer_length ptr ==>
addr <> (buffer_addr ptr h) + scale_t t i))
=
let n = buffer_length ptr in
let base = buffer_addr ptr h in
let rec aux (i:nat) : Tot (b:bool{not b <==> (forall j. i <= j /\ j < n ==>
addr <> base + scale_t t j)})
(decreases %[n-i]) =
if i >= n then false
else if addr = base + scale_t t i then true
else aux (i+1)
in aux 0
let valid_offset (t:base_typ) (n base:nat) (addr:int) (i:nat) =
exists j.{:pattern (scale_t t j)} i <= j /\ j < n /\ base + scale_t t j == addr
let rec get_addr_in_ptr (t:base_typ) (n base addr:nat) (i:nat) : Ghost nat
(requires valid_offset t n base addr i)
(ensures fun j -> base + scale_t t j == addr)
(decreases %[n - i])
=
if base + scale_t t i = addr then i
else get_addr_in_ptr t n base addr (i + 1)
let valid_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
DV.length (get_downview b.bsrc) % (view_n t) = 0 &&
addr_in_ptr #t addr b h
let writeable_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
valid_buffer t addr b h && b.writeable
#set-options "--max_fuel 1 --max_ifuel 1"
let sub_list (p1 p2:list 'a) = forall x. {:pattern List.memP x p2} List.memP x p1 ==> List.memP x p2
let rec valid_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b ->
b <==> (exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h)}
List.memP x ps /\ valid_buffer t addr x h))
=
match ps with
| [] -> false
| a::q -> valid_buffer t addr a h || valid_mem_aux t addr q h
let valid_mem (t:base_typ) addr (h:vale_heap) = valid_mem_aux t addr (_ih h).ptrs h
let valid_mem64 ptr h = valid_mem (TUInt64) ptr h
let rec find_valid_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o ->
match o with
| None -> not (valid_mem_aux t addr ps h)
| Some a -> valid_buffer t addr a h /\ List.memP a ps)
=
match ps with
| [] -> None
| a::q -> if valid_buffer t addr a h then Some a else find_valid_buffer_aux t addr q h
let find_valid_buffer (t:base_typ) (addr:int) (h:vale_heap) = find_valid_buffer_aux t addr (_ih h).ptrs h
let rec find_valid_buffer_aux_ps (t:base_typ) (addr:int) (ps:list b8) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs /\ sub_list ps (_ih h1).ptrs)
(ensures find_valid_buffer_aux t addr ps h1 == find_valid_buffer_aux t addr ps h2)
=
match ps with
| [] -> ()
| a::q -> find_valid_buffer_aux_ps t addr q h1 h2
let find_valid_buffer_ps (t:base_typ) (addr:int) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs)
(ensures find_valid_buffer t addr h1 == find_valid_buffer t addr h2)
=
find_valid_buffer_aux_ps t addr (_ih h1).ptrs h1 h2
let find_valid_buffer_valid_offset (t:base_typ) (addr:int) (h:vale_heap) : Lemma
(ensures (
match find_valid_buffer t addr h with
| None -> True
| Some a ->
let base = buffer_addr a h in
valid_offset t (buffer_length a) base addr 0
))
=
()
let rec writeable_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b -> b <==>
(exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h) \/ buffer_writeable x}
List.memP x ps /\ valid_buffer t addr x h /\ buffer_writeable x))
=
match ps with
| [] -> false
| a::q -> writeable_buffer t addr a h || writeable_mem_aux t addr q h
let writeable_mem (t:base_typ) addr (h:vale_heap) = writeable_mem_aux t addr (_ih h).ptrs h
let writeable_mem64 ptr h = writeable_mem (TUInt64) ptr h
let rec find_writeable_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o -> (
match o with
| None -> not (writeable_mem_aux t addr ps h)
| Some a -> writeable_buffer t addr a h /\ List.memP a ps
))
=
match ps with
| [] -> None
| a::q -> if writeable_buffer t addr a h then Some a else find_writeable_buffer_aux t addr q h
let find_writeable_buffer (t:base_typ) (addr:int) (h:vale_heap) =
find_writeable_buffer_aux t addr (_ih h).ptrs h
let load_mem (t:base_typ) (addr:int) (h:vale_heap) : GTot (base_typ_as_vale_type t) =
match find_valid_buffer t addr h with
| None -> default_of_typ t
| Some a ->
let base = buffer_addr a h in
buffer_read a (get_addr_in_ptr t (buffer_length a) base addr 0) h
let load_mem64 ptr h =
if not (valid_mem64 ptr h) then 0
else load_mem (TUInt64) ptr h
let length_t_eq (t:base_typ) (b:buffer t) :
Lemma (DV.length (get_downview b.bsrc) == buffer_length b * (view_n t)) =
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db (uint_view t) in
UV.length_eq ub;
assert (buffer_length b == DV.length db / (view_n t));
FStar.Math.Lib.lemma_div_def (DV.length db) (view_n t)
let get_addr_ptr (t:base_typ) (ptr:int) (h:vale_heap) : Ghost (buffer t)
(requires valid_mem t ptr h)
(ensures fun b -> List.memP b (_ih h).ptrs /\ valid_buffer t ptr b h)
=
Some?.v (find_valid_buffer t ptr h)
#reset-options "--max_fuel 0 --max_ifuel 0 --initial_fuel 0 --initial_ifuel 0 --z3rlimit 20"
let load_buffer_read (t:base_typ) (ptr:int) (h:vale_heap) : Lemma
(requires valid_mem t ptr h)
(ensures (
let b = get_addr_ptr t ptr h in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
load_mem t ptr h == buffer_read #t b i h
))
=
()
let store_mem (t:base_typ) (addr:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires True)
(ensures fun h1 -> (_ih h).addrs == (_ih h1).addrs /\ (_ih h).ptrs == (_ih h1).ptrs)
=
match find_writeable_buffer t addr h with
| None -> h
| Some a ->
let base = buffer_addr a h in
buffer_write a (get_addr_in_ptr t (buffer_length a) base addr 0) v h
let store_mem64 i v h =
if not (valid_mem64 i h) then h
else store_mem (TUInt64) i v h
let store_buffer_write
(t:base_typ)
(ptr:int)
(v:base_typ_as_vale_type t)
(h:vale_heap{writeable_mem t ptr h})
: Lemma
(ensures (
let b = Some?.v (find_writeable_buffer t ptr h) in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
store_mem t ptr v h == buffer_write b i v h
))
=
()
let valid_mem128 ptr h = valid_mem_aux (TUInt128) ptr (_ih h).ptrs h
let writeable_mem128 ptr h = writeable_mem_aux (TUInt128) ptr (_ih h).ptrs h
let load_mem128 ptr h =
if not (valid_mem128 ptr h) then (default_of_typ (TUInt128))
else load_mem (TUInt128) ptr h | false | false | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": 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": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap | [] | Vale.X64.Memory.store_mem128 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.Def.Types_s.quad32 -> h: Vale.Arch.HeapImpl.vale_heap
-> Prims.GTot Vale.Arch.HeapImpl.vale_heap | {
"end_col": 35,
"end_line": 498,
"start_col": 2,
"start_line": 497
} |
Prims.Tot | val layout_modifies_loc (layout:vale_heap_layout_inner) : loc | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let layout_modifies_loc layout = layout.vl_mod_loc | val layout_modifies_loc (layout:vale_heap_layout_inner) : loc
let layout_modifies_loc layout = | false | null | false | layout.vl_mod_loc | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"Vale.Arch.HeapImpl.vale_heap_layout_inner",
"Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout_inner__item__vl_mod_loc",
"Vale.X64.Memory.loc"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union
let loc_buffer #t b = M.loc_buffer b.bsrc
let loc_disjoint = M.loc_disjoint
let loc_includes = M.loc_includes
let modifies s h h' =
M.modifies s (_ih h).hs (_ih h').hs /\
h.heapletId == h'.heapletId /\
(_ih h).ptrs == (_ih h').ptrs /\
(_ih h).addrs == (_ih h').addrs /\
HST.equal_domains (_ih h).hs (_ih h').hs
let buffer_addr #t b h = IB.addrs_of_mem (_ih h) b
open FStar.Mul
#set-options "--z3rlimit 20"
let index64_heap_aux (s:Seq.lseq UInt8.t 8) (heap:S.machine_heap) (ptr:int) : Lemma
(requires forall (j:nat{j < 8}). UInt8.v (Seq.index s j) == heap.[ptr+j])
(ensures UInt64.v (Vale.Interop.Views.get64 s) == S.get_heap_val64 ptr heap) =
let open Vale.Def.Words.Seq_s in
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
Vale.Interop.Views.get64_reveal ();
S.get_heap_val64_reveal ();
Vale.Def.Types_s.le_bytes_to_nat64_reveal ()
let index_helper (x y:int) (heap:S.machine_heap) : Lemma
(requires x == y)
(ensures heap.[x] == heap.[y])
=
()
let index_mul_helper (addr i n j:int) : Lemma
(addr + (i * n + j) == addr + n * i + j) =
()
#set-options "--max_fuel 0 --max_ifuel 0"
let index64_get_heap_val64
(h:vale_heap)
(b:buffer64{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma (Seq.index (buffer_as_seq h b) i == S.get_heap_val64 (buffer_addr b h + scale8 i) heap)
=
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db uint64_view in
let ptr = buffer_addr b h + scale8 i in
let s = DV.as_seq (_ih h).hs db in
let t = TUInt64 in
let addr = buffer_addr b h in
UV.length_eq ub;
UV.as_seq_sel (_ih h).hs ub i;
UV.get_sel (_ih h).hs ub i;
let s' = Seq.slice s (i*8) (i*8 + 8) in
let aux (j:nat{j < 8}) : Lemma (UInt8.v (Seq.index s' j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*8 + j)) == heap.[addr + (i*8+j)]);
Seq.lemma_index_slice s (i*8) (i*8+8) j;
assert (UInt8.v (Seq.index s' j) == heap.[addr+(i*8+j)]);
index_mul_helper addr i 8 j;
()
in Classical.forall_intro aux;
index64_heap_aux s' heap ptr
#set-options "--z3rlimit 50"
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Four_s
open Vale.Lib.Seqs_s
let index128_get_heap_val128_aux (s:Seq.lseq UInt8.t 16) (ptr:int) (heap:S.machine_heap) : Lemma
(requires (forall (j:nat) . j < 16 ==> UInt8.v (Seq.index s j) == heap.[ptr+j]))
(ensures Vale.Interop.Views.get128 s == Mkfour
(S.get_heap_val32 ptr heap)
(S.get_heap_val32 (ptr+4) heap)
(S.get_heap_val32 (ptr+8) heap)
(S.get_heap_val32 (ptr+12) heap)) =
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
S.get_heap_val32_reveal ();
Vale.Interop.Views.get128_reveal ();
Vale.Def.Types_s.le_bytes_to_quad32_reveal ()
let index128_get_heap_val128
(h:vale_heap)
(b:buffer128{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma
(ensures (
let addr = buffer_addr b h in
Seq.index (buffer_as_seq h b) i ==
Mkfour
(S.get_heap_val32 (addr + scale16 i) heap)
(S.get_heap_val32 (addr + scale16 i+4) heap)
(S.get_heap_val32 (addr + scale16 i+8) heap)
(S.get_heap_val32 (addr + scale16 i +12) heap)
))
=
let db = get_downview b.bsrc in
let vb = UV.mk_buffer db uint128_view in
let ptr = buffer_addr b h + scale16 i in
let s = DV.as_seq (_ih h).hs db in
let addr = buffer_addr b h in
UV.length_eq vb;
UV.as_seq_sel (_ih h).hs vb i;
UV.get_sel (_ih h).hs vb i;
let sl = Seq.slice s (i*16) (i*16+16) in
let aux (j:nat{j < 16}) : Lemma (UInt8.v (Seq.index sl j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*16 + j)) == heap.[addr + (i*16+j)]);
Seq.lemma_index_slice s (i*16) (i*16+16) j;
assert (UInt8.v (Seq.index sl j) == heap.[addr+(i*16+j)]);
index_mul_helper addr i 16 j
in Classical.forall_intro aux;
index128_get_heap_val128_aux sl ptr heap
let modifies_goal_directed s h1 h2 = modifies s h1 h2
let lemma_modifies_goal_directed s h1 h2 = ()
let buffer_length_buffer_as_seq #t h b = ()
let same_underlying_seq (#t:base_typ) (h1 h2:vale_heap) (b:buffer t) : Lemma
(requires Seq.equal (DV.as_seq (_ih h1).hs (get_downview b.bsrc)) (DV.as_seq (_ih h2).hs (get_downview b.bsrc)))
(ensures Seq.equal (buffer_as_seq h1 b) (buffer_as_seq h2 b))
=
let db = get_downview b.bsrc in
let rec aux (i:nat{i <= buffer_length b}) : Lemma
(requires (forall (j:nat{j < i}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j) /\
(Seq.equal (DV.as_seq (_ih h1).hs db) (DV.as_seq (_ih h2).hs db)))
(ensures (forall (j:nat{j < buffer_length b}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j))
(decreases %[(buffer_length b) - i]) =
if i = buffer_length b then ()
else (
let bv = UV.mk_buffer db (uint_view t) in
UV.get_sel (_ih h1).hs bv i;
UV.get_sel (_ih h2).hs bv i;
UV.as_seq_sel (_ih h1).hs bv i;
UV.as_seq_sel (_ih h2).hs bv i;
aux (i+1)
)
in aux 0
let modifies_buffer_elim #t1 b p h h' =
let db = get_downview b.bsrc in
lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;
same_underlying_seq h h' b;
assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))
let modifies_buffer_addr #t b p h h' = ()
let modifies_buffer_readable #t b p h h' = ()
let loc_disjoint_none_r s = M.loc_disjoint_none_r s
let loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2
let loc_includes_refl s = M.loc_includes_refl s
let loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3
let loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2
let loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s
let loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)
let loc_includes_none s = M.loc_includes_none s
let modifies_refl s h = M.modifies_refl s (_ih h).hs
let modifies_goal_directed_refl s h = M.modifies_refl s (_ih h).hs
let modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2
let modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs
let modifies_goal_directed_trans s12 h1 h2 s13 h3 =
modifies_trans s12 h1 h2 s13 h3;
modifies_loc_includes s13 h1 h3 (loc_union s12 s13);
()
let modifies_goal_directed_trans2 s12 h1 h2 s13 h3 = modifies_goal_directed_trans s12 h1 h2 s13 h3
let default_of_typ (t:base_typ) : base_typ_as_vale_type t =
allow_inversion base_typ;
match t with
| TUInt8 -> 0
| TUInt16 -> 0
| TUInt32 -> 0
| TUInt64 -> 0
| TUInt128 -> Vale.Def.Words_s.Mkfour #nat32 0 0 0 0
let buffer_read #t b i h =
if i < 0 || i >= buffer_length b then default_of_typ t else
Seq.index (buffer_as_seq h b) i
let seq_upd
(#b:_)
(h:HS.mem)
(vb:UV.buffer b{UV.live h vb})
(i:nat{i < UV.length vb})
(x:b)
: Lemma
(Seq.equal
(Seq.upd (UV.as_seq h vb) i x)
(UV.as_seq (UV.upd h vb i x) vb))
=
let old_s = UV.as_seq h vb in
let new_s = UV.as_seq (UV.upd h vb i x) vb in
let upd_s = Seq.upd old_s i x in
let rec aux (k:nat) : Lemma
(requires (k <= Seq.length upd_s /\ (forall (j:nat). j < k ==> Seq.index upd_s j == Seq.index new_s j)))
(ensures (forall (j:nat). j < Seq.length upd_s ==> Seq.index upd_s j == Seq.index new_s j))
(decreases %[(Seq.length upd_s) - k]) =
if k = Seq.length upd_s then ()
else begin
UV.sel_upd vb i k x h;
UV.as_seq_sel h vb k;
UV.as_seq_sel (UV.upd h vb i x) vb k;
aux (k+1)
end
in aux 0
let buffer_write #t b i v h =
if i < 0 || i >= buffer_length b then h else
begin
let view = uint_view t in
let db = get_downview b.bsrc in
let bv = UV.mk_buffer db view in
UV.upd_modifies (_ih h).hs bv i (v_of_typ t v);
UV.upd_equal_domains (_ih h).hs bv i (v_of_typ t v);
let hs' = UV.upd (_ih h).hs bv i (v_of_typ t v) in
let ih' = InteropHeap (_ih h).ptrs (_ih h).addrs hs' in
let mh' = Vale.Interop.down_mem ih' in
let h':vale_heap = ValeHeap mh' (Ghost.hide ih') h.heapletId in
seq_upd (_ih h).hs bv i (v_of_typ t v);
assert (Seq.equal (buffer_as_seq h' b) (Seq.upd (buffer_as_seq h b) i v));
h'
end
unfold let scale_t (t:base_typ) (index:int) : int = scale_by (view_n t) index
// Checks if address addr corresponds to one of the elements of buffer ptr
let addr_in_ptr (#t:base_typ) (addr:int) (ptr:buffer t) (h:vale_heap) : Ghost bool
(requires True)
(ensures fun b -> not b <==>
(forall (i:int).{:pattern (scale_t t i)} 0 <= i /\ i < buffer_length ptr ==>
addr <> (buffer_addr ptr h) + scale_t t i))
=
let n = buffer_length ptr in
let base = buffer_addr ptr h in
let rec aux (i:nat) : Tot (b:bool{not b <==> (forall j. i <= j /\ j < n ==>
addr <> base + scale_t t j)})
(decreases %[n-i]) =
if i >= n then false
else if addr = base + scale_t t i then true
else aux (i+1)
in aux 0
let valid_offset (t:base_typ) (n base:nat) (addr:int) (i:nat) =
exists j.{:pattern (scale_t t j)} i <= j /\ j < n /\ base + scale_t t j == addr
let rec get_addr_in_ptr (t:base_typ) (n base addr:nat) (i:nat) : Ghost nat
(requires valid_offset t n base addr i)
(ensures fun j -> base + scale_t t j == addr)
(decreases %[n - i])
=
if base + scale_t t i = addr then i
else get_addr_in_ptr t n base addr (i + 1)
let valid_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
DV.length (get_downview b.bsrc) % (view_n t) = 0 &&
addr_in_ptr #t addr b h
let writeable_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
valid_buffer t addr b h && b.writeable
#set-options "--max_fuel 1 --max_ifuel 1"
let sub_list (p1 p2:list 'a) = forall x. {:pattern List.memP x p2} List.memP x p1 ==> List.memP x p2
let rec valid_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b ->
b <==> (exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h)}
List.memP x ps /\ valid_buffer t addr x h))
=
match ps with
| [] -> false
| a::q -> valid_buffer t addr a h || valid_mem_aux t addr q h
let valid_mem (t:base_typ) addr (h:vale_heap) = valid_mem_aux t addr (_ih h).ptrs h
let valid_mem64 ptr h = valid_mem (TUInt64) ptr h
let rec find_valid_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o ->
match o with
| None -> not (valid_mem_aux t addr ps h)
| Some a -> valid_buffer t addr a h /\ List.memP a ps)
=
match ps with
| [] -> None
| a::q -> if valid_buffer t addr a h then Some a else find_valid_buffer_aux t addr q h
let find_valid_buffer (t:base_typ) (addr:int) (h:vale_heap) = find_valid_buffer_aux t addr (_ih h).ptrs h
let rec find_valid_buffer_aux_ps (t:base_typ) (addr:int) (ps:list b8) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs /\ sub_list ps (_ih h1).ptrs)
(ensures find_valid_buffer_aux t addr ps h1 == find_valid_buffer_aux t addr ps h2)
=
match ps with
| [] -> ()
| a::q -> find_valid_buffer_aux_ps t addr q h1 h2
let find_valid_buffer_ps (t:base_typ) (addr:int) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs)
(ensures find_valid_buffer t addr h1 == find_valid_buffer t addr h2)
=
find_valid_buffer_aux_ps t addr (_ih h1).ptrs h1 h2
let find_valid_buffer_valid_offset (t:base_typ) (addr:int) (h:vale_heap) : Lemma
(ensures (
match find_valid_buffer t addr h with
| None -> True
| Some a ->
let base = buffer_addr a h in
valid_offset t (buffer_length a) base addr 0
))
=
()
let rec writeable_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b -> b <==>
(exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h) \/ buffer_writeable x}
List.memP x ps /\ valid_buffer t addr x h /\ buffer_writeable x))
=
match ps with
| [] -> false
| a::q -> writeable_buffer t addr a h || writeable_mem_aux t addr q h
let writeable_mem (t:base_typ) addr (h:vale_heap) = writeable_mem_aux t addr (_ih h).ptrs h
let writeable_mem64 ptr h = writeable_mem (TUInt64) ptr h
let rec find_writeable_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o -> (
match o with
| None -> not (writeable_mem_aux t addr ps h)
| Some a -> writeable_buffer t addr a h /\ List.memP a ps
))
=
match ps with
| [] -> None
| a::q -> if writeable_buffer t addr a h then Some a else find_writeable_buffer_aux t addr q h
let find_writeable_buffer (t:base_typ) (addr:int) (h:vale_heap) =
find_writeable_buffer_aux t addr (_ih h).ptrs h
let load_mem (t:base_typ) (addr:int) (h:vale_heap) : GTot (base_typ_as_vale_type t) =
match find_valid_buffer t addr h with
| None -> default_of_typ t
| Some a ->
let base = buffer_addr a h in
buffer_read a (get_addr_in_ptr t (buffer_length a) base addr 0) h
let load_mem64 ptr h =
if not (valid_mem64 ptr h) then 0
else load_mem (TUInt64) ptr h
let length_t_eq (t:base_typ) (b:buffer t) :
Lemma (DV.length (get_downview b.bsrc) == buffer_length b * (view_n t)) =
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db (uint_view t) in
UV.length_eq ub;
assert (buffer_length b == DV.length db / (view_n t));
FStar.Math.Lib.lemma_div_def (DV.length db) (view_n t)
let get_addr_ptr (t:base_typ) (ptr:int) (h:vale_heap) : Ghost (buffer t)
(requires valid_mem t ptr h)
(ensures fun b -> List.memP b (_ih h).ptrs /\ valid_buffer t ptr b h)
=
Some?.v (find_valid_buffer t ptr h)
#reset-options "--max_fuel 0 --max_ifuel 0 --initial_fuel 0 --initial_ifuel 0 --z3rlimit 20"
let load_buffer_read (t:base_typ) (ptr:int) (h:vale_heap) : Lemma
(requires valid_mem t ptr h)
(ensures (
let b = get_addr_ptr t ptr h in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
load_mem t ptr h == buffer_read #t b i h
))
=
()
let store_mem (t:base_typ) (addr:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires True)
(ensures fun h1 -> (_ih h).addrs == (_ih h1).addrs /\ (_ih h).ptrs == (_ih h1).ptrs)
=
match find_writeable_buffer t addr h with
| None -> h
| Some a ->
let base = buffer_addr a h in
buffer_write a (get_addr_in_ptr t (buffer_length a) base addr 0) v h
let store_mem64 i v h =
if not (valid_mem64 i h) then h
else store_mem (TUInt64) i v h
let store_buffer_write
(t:base_typ)
(ptr:int)
(v:base_typ_as_vale_type t)
(h:vale_heap{writeable_mem t ptr h})
: Lemma
(ensures (
let b = Some?.v (find_writeable_buffer t ptr h) in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
store_mem t ptr v h == buffer_write b i v h
))
=
()
let valid_mem128 ptr h = valid_mem_aux (TUInt128) ptr (_ih h).ptrs h
let writeable_mem128 ptr h = writeable_mem_aux (TUInt128) ptr (_ih h).ptrs h
let load_mem128 ptr h =
if not (valid_mem128 ptr h) then (default_of_typ (TUInt128))
else load_mem (TUInt128) ptr h
let store_mem128 ptr v h =
if not (valid_mem128 ptr h) then h
else store_mem (TUInt128) ptr v h
let lemma_valid_mem64 b i h = ()
let lemma_writeable_mem64 b i h = ()
let lemma_store_mem (t:base_typ) (b:buffer t) (i:nat) (v:base_typ_as_vale_type t) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem t (buffer_addr b h + scale_t t i) v h == buffer_write b i v h
)
=
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
let view = uint_view t in
let addr = buffer_addr b h + scale_t t i in
match find_writeable_buffer t addr h with
| None -> ()
| Some a ->
let da = get_downview a.bsrc in
let db = get_downview b.bsrc in
UV.length_eq (UV.mk_buffer da view);
UV.length_eq (UV.mk_buffer db view);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.disjoint_or_eq_b8 a b);
assert (a == b)
let lemma_load_mem64 b i h =
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
let addr = buffer_addr b h + scale8 i in
let view = uint64_view in
match find_valid_buffer TUInt64 addr h with
| None -> ()
| Some a ->
let da = get_downview a.bsrc in
let db = get_downview b.bsrc in
UV.length_eq (UV.mk_buffer da view);
UV.length_eq (UV.mk_buffer db view);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.disjoint_or_eq_b8 a b);
assert (a == b)
let lemma_store_mem64 b i v h = lemma_store_mem TUInt64 b i v h
let lemma_valid_mem128 b i h = ()
let lemma_writeable_mem128 b i h = ()
let lemma_load_mem128 b i h =
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
let addr = buffer_addr b h + scale16 i in
let view = uint128_view in
match find_valid_buffer TUInt128 addr h with
| None -> ()
| Some a ->
let da = get_downview a.bsrc in
let db = get_downview b.bsrc in
UV.length_eq (UV.mk_buffer da view);
UV.length_eq (UV.mk_buffer db view);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.disjoint_or_eq_b8 a b);
assert (a == b)
let lemma_store_mem128 b i v h = lemma_store_mem TUInt128 b i v h
open Vale.X64.Machine_s
let valid_taint_b8 (b:b8) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
let addr = (_ih h).addrs b in
(forall (i:int).{:pattern (mt.[i])}
addr <= i /\ i < addr + DV.length (get_downview b.bsrc) ==> mt.[i] == tn)
let valid_taint_buf #t b h mt tn =
valid_taint_b8 b h mt tn
let apply_taint_buf (#t:base_typ) (b:buffer t) (mem:vale_heap) (memTaint:memtaint) (tn:taint) (i:nat) : Lemma
(requires i < DV.length (get_downview b.bsrc) /\ valid_taint_buf b mem memTaint tn)
(ensures memTaint.[(_ih mem).addrs b + i] == tn)
=
()
let lemma_valid_taint64 b memTaint mem i t =
length_t_eq (TUInt64) b;
let ptr = buffer_addr b mem + scale8 i in
let aux (i':nat) : Lemma
(requires i' >= ptr /\ i' < ptr + 8)
(ensures memTaint.[i'] == t) =
let extra = scale8 i + i' - ptr in
assert (i' == (_ih mem).addrs b + extra);
apply_taint_buf b mem memTaint t extra
in
Classical.forall_intro (Classical.move_requires aux)
let lemma_valid_taint128 b memTaint mem i t =
length_t_eq (TUInt128) b;
let ptr = buffer_addr b mem + scale16 i in
let aux i' : Lemma
(requires i' >= ptr /\ i' < ptr + 16)
(ensures memTaint.[i'] == t) =
let extra = scale16 i + i' - ptr in
assert (i' == (_ih mem).addrs b + extra);
apply_taint_buf b mem memTaint t extra
in
Classical.forall_intro (Classical.move_requires aux)
let same_memTaint (t:base_typ) (b:buffer t) (mem0 mem1:vale_heap) (memT0 memT1:memtaint) : Lemma
(requires modifies (loc_buffer b) mem0 mem1 /\
(forall p. Map.sel memT0 p == Map.sel memT1 p))
(ensures memT0 == memT1) =
assert (Map.equal memT0 memT1)
let same_memTaint64 b mem0 mem1 memtaint0 memtaint1 =
same_memTaint (TUInt64) b mem0 mem1 memtaint0 memtaint1
let same_memTaint128 b mem0 mem1 memtaint0 memtaint1 =
same_memTaint (TUInt128) b mem0 mem1 memtaint0 memtaint1
let modifies_valid_taint #t b p h h' mt tn =
let dv = get_downview b.bsrc in
let imp_left () : Lemma
(requires valid_taint_buf b h mt tn)
(ensures valid_taint_buf b h' mt tn) =
let aux (i:nat{i < DV.length dv}) : Lemma (mt.[(_ih h').addrs b + i] = tn) =
apply_taint_buf b h mt tn i
in Classical.forall_intro aux
in let imp_right () : Lemma
(requires valid_taint_buf b h' mt tn)
(ensures valid_taint_buf b h mt tn) =
let aux (i:nat{i < DV.length dv}) : Lemma (mt.[(_ih h).addrs b + i] = tn) =
apply_taint_buf b h' mt tn i
in Classical.forall_intro aux
in
(Classical.move_requires imp_left());
(Classical.move_requires imp_right())
#set-options "--initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let modifies_same_heaplet_id l h1 h2 =
()
let valid_taint_bufs (mem:vale_heap) (memTaint:memtaint) (ps:list b8) (ts:b8 -> GTot taint) =
forall b.{:pattern List.memP b ps} List.memP b ps ==> valid_taint_b8 b mem memTaint (ts b)
let rec write_taint_lemma (i:nat) (mem:IB.interop_heap) (ts:b8 -> GTot taint) (b:b8) (accu:memtaint) : Lemma
(requires
i <= DV.length (get_downview b.bsrc) /\
(forall (j:int).{:pattern accu.[j]} mem.addrs b <= j /\ j < mem.addrs b + i ==> accu.[j] = ts b)
)
(ensures (
let m = IB.write_taint i mem ts b accu in
let addr = mem.addrs b in
(forall j.{:pattern m.[j]} addr <= j /\ j < addr + DV.length (get_downview b.bsrc) ==>
m.[j] = ts b) /\
(forall j. {:pattern m.[j]} j < addr \/ j >= addr + DV.length (get_downview b.bsrc) ==>
m.[j] == accu.[j])))
(decreases %[DV.length (get_downview b.bsrc) - i])
=
let m = IB.write_taint i mem ts b accu in
let addr = mem.addrs b in
if i >= DV.length (get_downview b.bsrc) then ()
else
let new_accu = accu.[addr+i] <- ts b in
assert (IB.write_taint i mem ts b accu == IB.write_taint (i + 1) mem ts b new_accu);
assert (Set.equal (Map.domain new_accu) (Set.complement Set.empty));
assert (forall j.{:pattern m.[j]} addr <= j /\ j < addr + i + 1 ==> new_accu.[j] == ts b);
write_taint_lemma (i + 1) mem ts b new_accu
#restart-solver
let rec valid_memtaint (mem:vale_heap) (ps:list b8) (ts:b8 -> GTot taint) : Lemma
(requires IB.list_disjoint_or_eq ps)
(ensures valid_taint_bufs mem (IB.create_memtaint (_ih mem) ps ts) ps ts)
=
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
match ps with
| [] -> ()
| b :: q ->
assert (List.memP b ps);
assert (forall i. {:pattern List.memP i q} List.memP i q ==> List.memP i ps);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.list_disjoint_or_eq q);
valid_memtaint mem q ts;
assert (IB.create_memtaint (_ih mem) ps ts ==
IB.write_taint 0 (_ih mem) ts b (IB.create_memtaint (_ih mem) q ts));
write_taint_lemma 0 (_ih mem) ts b (IB.create_memtaint (_ih mem) q ts);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (forall p. List.memP p q ==> IB.disjoint_or_eq_b8 p b)
let valid_layout_data_buffer (t:base_typ) (b:buffer t) (layout:vale_heap_layout_inner) (hid:heaplet_id) (write:bool) =
exists (n:nat).{:pattern (Seq.index layout.vl_buffers n)} n < Seq.length layout.vl_buffers /\ (
let bi = Seq.index layout.vl_buffers n in
t == bi.bi_typ /\
b == bi.bi_buffer /\
(write ==> bi.bi_mutable == Mutable) /\
hid == bi.bi_heaplet)
[@"opaque_to_smt"]
let valid_layout_buffer_id t b layout h_id write =
match h_id with
| None -> True
| Some hid ->
layout.vl_inner.vl_heaplets_initialized /\
valid_layout_data_buffer t b layout.vl_inner hid write
let inv_heaplet_ids (hs:vale_heaplets) =
forall (i:heaplet_id).{:pattern Map16.sel hs i} (Map16.sel hs i).heapletId == Some i
let inv_heaplet (owns:Set.set int) (h hi:vale_heap) =
h.ih.IB.ptrs == hi.ih.IB.ptrs /\
Map.domain h.mh == Map.domain hi.mh /\
(forall (i:int).{:pattern Set.mem i owns \/ Set.mem i (Map.domain h.mh) \/ Map.sel h.mh i \/ Map.sel hi.mh i}
Set.mem i owns ==>
Set.mem i (Map.domain h.mh) /\
Map.sel h.mh i == Map.sel hi.mh i /\
True
) /\
True
// heaplet state matches heap state
let inv_buffer_info (bi:buffer_info) (owners:heaplet_id -> Set.set int) (h:vale_heap) (hs:vale_heaplets) (mt:memTaint_t) (modloc:loc) =
let t = bi.bi_typ in
let hid = bi.bi_heaplet in
let hi = Map16.get hs hid in
let b = bi.bi_buffer in
let owns = owners hid in
(bi.bi_mutable == Mutable ==> loc_includes modloc (loc_buffer b)) /\
buffer_readable h b /\
buffer_as_seq hi b == buffer_as_seq h b /\
(valid_taint_buf b hi mt bi.bi_taint <==> valid_taint_buf b h mt bi.bi_taint) /\
(forall (i:int).{:pattern Set.mem i owns}
buffer_addr b h <= i /\ i < buffer_addr b h + DV.length (get_downview b.bsrc) ==> Set.mem i owns) /\
True
let inv_heaplets (layout:vale_heap_layout_inner) (h:vale_heap) (hs:vale_heaplets) (mt:memTaint_t) =
let bs = layout.vl_buffers in
modifies layout.vl_mod_loc layout.vl_old_heap h /\ // modifies for entire heap
(forall (i:heaplet_id) (a:int).{:pattern Set.mem a (layout.vl_heaplet_sets i)}
layout.vl_heaplet_map a == Some i <==> Set.mem a (layout.vl_heaplet_sets i)
) /\
(forall (i:heaplet_id).{:pattern (Map16.sel hs i)}
inv_heaplet (layout.vl_heaplet_sets i) h (Map16.sel hs i)) /\
(forall (i:nat).{:pattern (Seq.index bs i)} i < Seq.length bs ==>
inv_buffer_info (Seq.index bs i) layout.vl_heaplet_sets h hs mt layout.vl_mod_loc) /\
(forall (i1 i2:nat).{:pattern (Seq.index bs i1); (Seq.index bs i2)}
i1 < Seq.length bs /\ i2 < Seq.length bs ==> buffer_info_disjoint (Seq.index bs i1) (Seq.index bs i2)) /\
True
let is_initial_heap layout h =
h == layout.vl_inner.vl_old_heap /\
not layout.vl_inner.vl_heaplets_initialized
let mem_inv h =
h.vf_heap.heapletId == None /\
inv_heaplet_ids h.vf_heaplets /\
(if h.vf_layout.vl_inner.vl_heaplets_initialized
then
inv_heaplets h.vf_layout.vl_inner h.vf_heap
h.vf_heaplets h.vf_layout.vl_taint
else
h.vf_heaplets == empty_vale_heaplets h.vf_layout.vl_inner.vl_old_heap
)
let layout_heaplets_initialized layout = layout.vl_heaplets_initialized | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": 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": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val layout_modifies_loc (layout:vale_heap_layout_inner) : loc | [] | Vale.X64.Memory.layout_modifies_loc | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | layout: Vale.Arch.HeapImpl.vale_heap_layout_inner -> Vale.X64.Memory.loc | {
"end_col": 50,
"end_line": 755,
"start_col": 33,
"start_line": 755
} |
Prims.GTot | val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64 | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let load_mem64 ptr h =
if not (valid_mem64 ptr h) then 0
else load_mem (TUInt64) ptr h | val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64
let load_mem64 ptr h = | false | null | false | if not (valid_mem64 ptr h) then 0 else load_mem (TUInt64) ptr h | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.Arch.HeapImpl.vale_heap",
"Prims.op_Negation",
"Vale.X64.Memory.valid_mem64",
"Prims.bool",
"Vale.X64.Memory.load_mem",
"Vale.Arch.HeapTypes_s.TUInt64",
"Vale.Def.Types_s.nat64"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union
let loc_buffer #t b = M.loc_buffer b.bsrc
let loc_disjoint = M.loc_disjoint
let loc_includes = M.loc_includes
let modifies s h h' =
M.modifies s (_ih h).hs (_ih h').hs /\
h.heapletId == h'.heapletId /\
(_ih h).ptrs == (_ih h').ptrs /\
(_ih h).addrs == (_ih h').addrs /\
HST.equal_domains (_ih h).hs (_ih h').hs
let buffer_addr #t b h = IB.addrs_of_mem (_ih h) b
open FStar.Mul
#set-options "--z3rlimit 20"
let index64_heap_aux (s:Seq.lseq UInt8.t 8) (heap:S.machine_heap) (ptr:int) : Lemma
(requires forall (j:nat{j < 8}). UInt8.v (Seq.index s j) == heap.[ptr+j])
(ensures UInt64.v (Vale.Interop.Views.get64 s) == S.get_heap_val64 ptr heap) =
let open Vale.Def.Words.Seq_s in
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
Vale.Interop.Views.get64_reveal ();
S.get_heap_val64_reveal ();
Vale.Def.Types_s.le_bytes_to_nat64_reveal ()
let index_helper (x y:int) (heap:S.machine_heap) : Lemma
(requires x == y)
(ensures heap.[x] == heap.[y])
=
()
let index_mul_helper (addr i n j:int) : Lemma
(addr + (i * n + j) == addr + n * i + j) =
()
#set-options "--max_fuel 0 --max_ifuel 0"
let index64_get_heap_val64
(h:vale_heap)
(b:buffer64{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma (Seq.index (buffer_as_seq h b) i == S.get_heap_val64 (buffer_addr b h + scale8 i) heap)
=
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db uint64_view in
let ptr = buffer_addr b h + scale8 i in
let s = DV.as_seq (_ih h).hs db in
let t = TUInt64 in
let addr = buffer_addr b h in
UV.length_eq ub;
UV.as_seq_sel (_ih h).hs ub i;
UV.get_sel (_ih h).hs ub i;
let s' = Seq.slice s (i*8) (i*8 + 8) in
let aux (j:nat{j < 8}) : Lemma (UInt8.v (Seq.index s' j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*8 + j)) == heap.[addr + (i*8+j)]);
Seq.lemma_index_slice s (i*8) (i*8+8) j;
assert (UInt8.v (Seq.index s' j) == heap.[addr+(i*8+j)]);
index_mul_helper addr i 8 j;
()
in Classical.forall_intro aux;
index64_heap_aux s' heap ptr
#set-options "--z3rlimit 50"
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Four_s
open Vale.Lib.Seqs_s
let index128_get_heap_val128_aux (s:Seq.lseq UInt8.t 16) (ptr:int) (heap:S.machine_heap) : Lemma
(requires (forall (j:nat) . j < 16 ==> UInt8.v (Seq.index s j) == heap.[ptr+j]))
(ensures Vale.Interop.Views.get128 s == Mkfour
(S.get_heap_val32 ptr heap)
(S.get_heap_val32 (ptr+4) heap)
(S.get_heap_val32 (ptr+8) heap)
(S.get_heap_val32 (ptr+12) heap)) =
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
S.get_heap_val32_reveal ();
Vale.Interop.Views.get128_reveal ();
Vale.Def.Types_s.le_bytes_to_quad32_reveal ()
let index128_get_heap_val128
(h:vale_heap)
(b:buffer128{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma
(ensures (
let addr = buffer_addr b h in
Seq.index (buffer_as_seq h b) i ==
Mkfour
(S.get_heap_val32 (addr + scale16 i) heap)
(S.get_heap_val32 (addr + scale16 i+4) heap)
(S.get_heap_val32 (addr + scale16 i+8) heap)
(S.get_heap_val32 (addr + scale16 i +12) heap)
))
=
let db = get_downview b.bsrc in
let vb = UV.mk_buffer db uint128_view in
let ptr = buffer_addr b h + scale16 i in
let s = DV.as_seq (_ih h).hs db in
let addr = buffer_addr b h in
UV.length_eq vb;
UV.as_seq_sel (_ih h).hs vb i;
UV.get_sel (_ih h).hs vb i;
let sl = Seq.slice s (i*16) (i*16+16) in
let aux (j:nat{j < 16}) : Lemma (UInt8.v (Seq.index sl j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*16 + j)) == heap.[addr + (i*16+j)]);
Seq.lemma_index_slice s (i*16) (i*16+16) j;
assert (UInt8.v (Seq.index sl j) == heap.[addr+(i*16+j)]);
index_mul_helper addr i 16 j
in Classical.forall_intro aux;
index128_get_heap_val128_aux sl ptr heap
let modifies_goal_directed s h1 h2 = modifies s h1 h2
let lemma_modifies_goal_directed s h1 h2 = ()
let buffer_length_buffer_as_seq #t h b = ()
let same_underlying_seq (#t:base_typ) (h1 h2:vale_heap) (b:buffer t) : Lemma
(requires Seq.equal (DV.as_seq (_ih h1).hs (get_downview b.bsrc)) (DV.as_seq (_ih h2).hs (get_downview b.bsrc)))
(ensures Seq.equal (buffer_as_seq h1 b) (buffer_as_seq h2 b))
=
let db = get_downview b.bsrc in
let rec aux (i:nat{i <= buffer_length b}) : Lemma
(requires (forall (j:nat{j < i}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j) /\
(Seq.equal (DV.as_seq (_ih h1).hs db) (DV.as_seq (_ih h2).hs db)))
(ensures (forall (j:nat{j < buffer_length b}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j))
(decreases %[(buffer_length b) - i]) =
if i = buffer_length b then ()
else (
let bv = UV.mk_buffer db (uint_view t) in
UV.get_sel (_ih h1).hs bv i;
UV.get_sel (_ih h2).hs bv i;
UV.as_seq_sel (_ih h1).hs bv i;
UV.as_seq_sel (_ih h2).hs bv i;
aux (i+1)
)
in aux 0
let modifies_buffer_elim #t1 b p h h' =
let db = get_downview b.bsrc in
lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;
same_underlying_seq h h' b;
assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))
let modifies_buffer_addr #t b p h h' = ()
let modifies_buffer_readable #t b p h h' = ()
let loc_disjoint_none_r s = M.loc_disjoint_none_r s
let loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2
let loc_includes_refl s = M.loc_includes_refl s
let loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3
let loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2
let loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s
let loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)
let loc_includes_none s = M.loc_includes_none s
let modifies_refl s h = M.modifies_refl s (_ih h).hs
let modifies_goal_directed_refl s h = M.modifies_refl s (_ih h).hs
let modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2
let modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs
let modifies_goal_directed_trans s12 h1 h2 s13 h3 =
modifies_trans s12 h1 h2 s13 h3;
modifies_loc_includes s13 h1 h3 (loc_union s12 s13);
()
let modifies_goal_directed_trans2 s12 h1 h2 s13 h3 = modifies_goal_directed_trans s12 h1 h2 s13 h3
let default_of_typ (t:base_typ) : base_typ_as_vale_type t =
allow_inversion base_typ;
match t with
| TUInt8 -> 0
| TUInt16 -> 0
| TUInt32 -> 0
| TUInt64 -> 0
| TUInt128 -> Vale.Def.Words_s.Mkfour #nat32 0 0 0 0
let buffer_read #t b i h =
if i < 0 || i >= buffer_length b then default_of_typ t else
Seq.index (buffer_as_seq h b) i
let seq_upd
(#b:_)
(h:HS.mem)
(vb:UV.buffer b{UV.live h vb})
(i:nat{i < UV.length vb})
(x:b)
: Lemma
(Seq.equal
(Seq.upd (UV.as_seq h vb) i x)
(UV.as_seq (UV.upd h vb i x) vb))
=
let old_s = UV.as_seq h vb in
let new_s = UV.as_seq (UV.upd h vb i x) vb in
let upd_s = Seq.upd old_s i x in
let rec aux (k:nat) : Lemma
(requires (k <= Seq.length upd_s /\ (forall (j:nat). j < k ==> Seq.index upd_s j == Seq.index new_s j)))
(ensures (forall (j:nat). j < Seq.length upd_s ==> Seq.index upd_s j == Seq.index new_s j))
(decreases %[(Seq.length upd_s) - k]) =
if k = Seq.length upd_s then ()
else begin
UV.sel_upd vb i k x h;
UV.as_seq_sel h vb k;
UV.as_seq_sel (UV.upd h vb i x) vb k;
aux (k+1)
end
in aux 0
let buffer_write #t b i v h =
if i < 0 || i >= buffer_length b then h else
begin
let view = uint_view t in
let db = get_downview b.bsrc in
let bv = UV.mk_buffer db view in
UV.upd_modifies (_ih h).hs bv i (v_of_typ t v);
UV.upd_equal_domains (_ih h).hs bv i (v_of_typ t v);
let hs' = UV.upd (_ih h).hs bv i (v_of_typ t v) in
let ih' = InteropHeap (_ih h).ptrs (_ih h).addrs hs' in
let mh' = Vale.Interop.down_mem ih' in
let h':vale_heap = ValeHeap mh' (Ghost.hide ih') h.heapletId in
seq_upd (_ih h).hs bv i (v_of_typ t v);
assert (Seq.equal (buffer_as_seq h' b) (Seq.upd (buffer_as_seq h b) i v));
h'
end
unfold let scale_t (t:base_typ) (index:int) : int = scale_by (view_n t) index
// Checks if address addr corresponds to one of the elements of buffer ptr
let addr_in_ptr (#t:base_typ) (addr:int) (ptr:buffer t) (h:vale_heap) : Ghost bool
(requires True)
(ensures fun b -> not b <==>
(forall (i:int).{:pattern (scale_t t i)} 0 <= i /\ i < buffer_length ptr ==>
addr <> (buffer_addr ptr h) + scale_t t i))
=
let n = buffer_length ptr in
let base = buffer_addr ptr h in
let rec aux (i:nat) : Tot (b:bool{not b <==> (forall j. i <= j /\ j < n ==>
addr <> base + scale_t t j)})
(decreases %[n-i]) =
if i >= n then false
else if addr = base + scale_t t i then true
else aux (i+1)
in aux 0
let valid_offset (t:base_typ) (n base:nat) (addr:int) (i:nat) =
exists j.{:pattern (scale_t t j)} i <= j /\ j < n /\ base + scale_t t j == addr
let rec get_addr_in_ptr (t:base_typ) (n base addr:nat) (i:nat) : Ghost nat
(requires valid_offset t n base addr i)
(ensures fun j -> base + scale_t t j == addr)
(decreases %[n - i])
=
if base + scale_t t i = addr then i
else get_addr_in_ptr t n base addr (i + 1)
let valid_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
DV.length (get_downview b.bsrc) % (view_n t) = 0 &&
addr_in_ptr #t addr b h
let writeable_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
valid_buffer t addr b h && b.writeable
#set-options "--max_fuel 1 --max_ifuel 1"
let sub_list (p1 p2:list 'a) = forall x. {:pattern List.memP x p2} List.memP x p1 ==> List.memP x p2
let rec valid_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b ->
b <==> (exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h)}
List.memP x ps /\ valid_buffer t addr x h))
=
match ps with
| [] -> false
| a::q -> valid_buffer t addr a h || valid_mem_aux t addr q h
let valid_mem (t:base_typ) addr (h:vale_heap) = valid_mem_aux t addr (_ih h).ptrs h
let valid_mem64 ptr h = valid_mem (TUInt64) ptr h
let rec find_valid_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o ->
match o with
| None -> not (valid_mem_aux t addr ps h)
| Some a -> valid_buffer t addr a h /\ List.memP a ps)
=
match ps with
| [] -> None
| a::q -> if valid_buffer t addr a h then Some a else find_valid_buffer_aux t addr q h
let find_valid_buffer (t:base_typ) (addr:int) (h:vale_heap) = find_valid_buffer_aux t addr (_ih h).ptrs h
let rec find_valid_buffer_aux_ps (t:base_typ) (addr:int) (ps:list b8) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs /\ sub_list ps (_ih h1).ptrs)
(ensures find_valid_buffer_aux t addr ps h1 == find_valid_buffer_aux t addr ps h2)
=
match ps with
| [] -> ()
| a::q -> find_valid_buffer_aux_ps t addr q h1 h2
let find_valid_buffer_ps (t:base_typ) (addr:int) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs)
(ensures find_valid_buffer t addr h1 == find_valid_buffer t addr h2)
=
find_valid_buffer_aux_ps t addr (_ih h1).ptrs h1 h2
let find_valid_buffer_valid_offset (t:base_typ) (addr:int) (h:vale_heap) : Lemma
(ensures (
match find_valid_buffer t addr h with
| None -> True
| Some a ->
let base = buffer_addr a h in
valid_offset t (buffer_length a) base addr 0
))
=
()
let rec writeable_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b -> b <==>
(exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h) \/ buffer_writeable x}
List.memP x ps /\ valid_buffer t addr x h /\ buffer_writeable x))
=
match ps with
| [] -> false
| a::q -> writeable_buffer t addr a h || writeable_mem_aux t addr q h
let writeable_mem (t:base_typ) addr (h:vale_heap) = writeable_mem_aux t addr (_ih h).ptrs h
let writeable_mem64 ptr h = writeable_mem (TUInt64) ptr h
let rec find_writeable_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o -> (
match o with
| None -> not (writeable_mem_aux t addr ps h)
| Some a -> writeable_buffer t addr a h /\ List.memP a ps
))
=
match ps with
| [] -> None
| a::q -> if writeable_buffer t addr a h then Some a else find_writeable_buffer_aux t addr q h
let find_writeable_buffer (t:base_typ) (addr:int) (h:vale_heap) =
find_writeable_buffer_aux t addr (_ih h).ptrs h
let load_mem (t:base_typ) (addr:int) (h:vale_heap) : GTot (base_typ_as_vale_type t) =
match find_valid_buffer t addr h with
| None -> default_of_typ t
| Some a ->
let base = buffer_addr a h in
buffer_read a (get_addr_in_ptr t (buffer_length a) base addr 0) h | false | false | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": 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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64 | [] | Vale.X64.Memory.load_mem64 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> h: Vale.Arch.HeapImpl.vale_heap -> Prims.GTot Vale.Def.Types_s.nat64 | {
"end_col": 31,
"end_line": 436,
"start_col": 2,
"start_line": 435
} |
Prims.Tot | val layout_heaplets_initialized (layout:vale_heap_layout_inner) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let layout_heaplets_initialized layout = layout.vl_heaplets_initialized | val layout_heaplets_initialized (layout:vale_heap_layout_inner) : bool
let layout_heaplets_initialized layout = | false | null | false | layout.vl_heaplets_initialized | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"Vale.Arch.HeapImpl.vale_heap_layout_inner",
"Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout_inner__item__vl_heaplets_initialized",
"Prims.bool"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union
let loc_buffer #t b = M.loc_buffer b.bsrc
let loc_disjoint = M.loc_disjoint
let loc_includes = M.loc_includes
let modifies s h h' =
M.modifies s (_ih h).hs (_ih h').hs /\
h.heapletId == h'.heapletId /\
(_ih h).ptrs == (_ih h').ptrs /\
(_ih h).addrs == (_ih h').addrs /\
HST.equal_domains (_ih h).hs (_ih h').hs
let buffer_addr #t b h = IB.addrs_of_mem (_ih h) b
open FStar.Mul
#set-options "--z3rlimit 20"
let index64_heap_aux (s:Seq.lseq UInt8.t 8) (heap:S.machine_heap) (ptr:int) : Lemma
(requires forall (j:nat{j < 8}). UInt8.v (Seq.index s j) == heap.[ptr+j])
(ensures UInt64.v (Vale.Interop.Views.get64 s) == S.get_heap_val64 ptr heap) =
let open Vale.Def.Words.Seq_s in
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
Vale.Interop.Views.get64_reveal ();
S.get_heap_val64_reveal ();
Vale.Def.Types_s.le_bytes_to_nat64_reveal ()
let index_helper (x y:int) (heap:S.machine_heap) : Lemma
(requires x == y)
(ensures heap.[x] == heap.[y])
=
()
let index_mul_helper (addr i n j:int) : Lemma
(addr + (i * n + j) == addr + n * i + j) =
()
#set-options "--max_fuel 0 --max_ifuel 0"
let index64_get_heap_val64
(h:vale_heap)
(b:buffer64{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma (Seq.index (buffer_as_seq h b) i == S.get_heap_val64 (buffer_addr b h + scale8 i) heap)
=
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db uint64_view in
let ptr = buffer_addr b h + scale8 i in
let s = DV.as_seq (_ih h).hs db in
let t = TUInt64 in
let addr = buffer_addr b h in
UV.length_eq ub;
UV.as_seq_sel (_ih h).hs ub i;
UV.get_sel (_ih h).hs ub i;
let s' = Seq.slice s (i*8) (i*8 + 8) in
let aux (j:nat{j < 8}) : Lemma (UInt8.v (Seq.index s' j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*8 + j)) == heap.[addr + (i*8+j)]);
Seq.lemma_index_slice s (i*8) (i*8+8) j;
assert (UInt8.v (Seq.index s' j) == heap.[addr+(i*8+j)]);
index_mul_helper addr i 8 j;
()
in Classical.forall_intro aux;
index64_heap_aux s' heap ptr
#set-options "--z3rlimit 50"
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Four_s
open Vale.Lib.Seqs_s
let index128_get_heap_val128_aux (s:Seq.lseq UInt8.t 16) (ptr:int) (heap:S.machine_heap) : Lemma
(requires (forall (j:nat) . j < 16 ==> UInt8.v (Seq.index s j) == heap.[ptr+j]))
(ensures Vale.Interop.Views.get128 s == Mkfour
(S.get_heap_val32 ptr heap)
(S.get_heap_val32 (ptr+4) heap)
(S.get_heap_val32 (ptr+8) heap)
(S.get_heap_val32 (ptr+12) heap)) =
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
S.get_heap_val32_reveal ();
Vale.Interop.Views.get128_reveal ();
Vale.Def.Types_s.le_bytes_to_quad32_reveal ()
let index128_get_heap_val128
(h:vale_heap)
(b:buffer128{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma
(ensures (
let addr = buffer_addr b h in
Seq.index (buffer_as_seq h b) i ==
Mkfour
(S.get_heap_val32 (addr + scale16 i) heap)
(S.get_heap_val32 (addr + scale16 i+4) heap)
(S.get_heap_val32 (addr + scale16 i+8) heap)
(S.get_heap_val32 (addr + scale16 i +12) heap)
))
=
let db = get_downview b.bsrc in
let vb = UV.mk_buffer db uint128_view in
let ptr = buffer_addr b h + scale16 i in
let s = DV.as_seq (_ih h).hs db in
let addr = buffer_addr b h in
UV.length_eq vb;
UV.as_seq_sel (_ih h).hs vb i;
UV.get_sel (_ih h).hs vb i;
let sl = Seq.slice s (i*16) (i*16+16) in
let aux (j:nat{j < 16}) : Lemma (UInt8.v (Seq.index sl j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*16 + j)) == heap.[addr + (i*16+j)]);
Seq.lemma_index_slice s (i*16) (i*16+16) j;
assert (UInt8.v (Seq.index sl j) == heap.[addr+(i*16+j)]);
index_mul_helper addr i 16 j
in Classical.forall_intro aux;
index128_get_heap_val128_aux sl ptr heap
let modifies_goal_directed s h1 h2 = modifies s h1 h2
let lemma_modifies_goal_directed s h1 h2 = ()
let buffer_length_buffer_as_seq #t h b = ()
let same_underlying_seq (#t:base_typ) (h1 h2:vale_heap) (b:buffer t) : Lemma
(requires Seq.equal (DV.as_seq (_ih h1).hs (get_downview b.bsrc)) (DV.as_seq (_ih h2).hs (get_downview b.bsrc)))
(ensures Seq.equal (buffer_as_seq h1 b) (buffer_as_seq h2 b))
=
let db = get_downview b.bsrc in
let rec aux (i:nat{i <= buffer_length b}) : Lemma
(requires (forall (j:nat{j < i}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j) /\
(Seq.equal (DV.as_seq (_ih h1).hs db) (DV.as_seq (_ih h2).hs db)))
(ensures (forall (j:nat{j < buffer_length b}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j))
(decreases %[(buffer_length b) - i]) =
if i = buffer_length b then ()
else (
let bv = UV.mk_buffer db (uint_view t) in
UV.get_sel (_ih h1).hs bv i;
UV.get_sel (_ih h2).hs bv i;
UV.as_seq_sel (_ih h1).hs bv i;
UV.as_seq_sel (_ih h2).hs bv i;
aux (i+1)
)
in aux 0
let modifies_buffer_elim #t1 b p h h' =
let db = get_downview b.bsrc in
lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;
same_underlying_seq h h' b;
assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))
let modifies_buffer_addr #t b p h h' = ()
let modifies_buffer_readable #t b p h h' = ()
let loc_disjoint_none_r s = M.loc_disjoint_none_r s
let loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2
let loc_includes_refl s = M.loc_includes_refl s
let loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3
let loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2
let loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s
let loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)
let loc_includes_none s = M.loc_includes_none s
let modifies_refl s h = M.modifies_refl s (_ih h).hs
let modifies_goal_directed_refl s h = M.modifies_refl s (_ih h).hs
let modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2
let modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs
let modifies_goal_directed_trans s12 h1 h2 s13 h3 =
modifies_trans s12 h1 h2 s13 h3;
modifies_loc_includes s13 h1 h3 (loc_union s12 s13);
()
let modifies_goal_directed_trans2 s12 h1 h2 s13 h3 = modifies_goal_directed_trans s12 h1 h2 s13 h3
let default_of_typ (t:base_typ) : base_typ_as_vale_type t =
allow_inversion base_typ;
match t with
| TUInt8 -> 0
| TUInt16 -> 0
| TUInt32 -> 0
| TUInt64 -> 0
| TUInt128 -> Vale.Def.Words_s.Mkfour #nat32 0 0 0 0
let buffer_read #t b i h =
if i < 0 || i >= buffer_length b then default_of_typ t else
Seq.index (buffer_as_seq h b) i
let seq_upd
(#b:_)
(h:HS.mem)
(vb:UV.buffer b{UV.live h vb})
(i:nat{i < UV.length vb})
(x:b)
: Lemma
(Seq.equal
(Seq.upd (UV.as_seq h vb) i x)
(UV.as_seq (UV.upd h vb i x) vb))
=
let old_s = UV.as_seq h vb in
let new_s = UV.as_seq (UV.upd h vb i x) vb in
let upd_s = Seq.upd old_s i x in
let rec aux (k:nat) : Lemma
(requires (k <= Seq.length upd_s /\ (forall (j:nat). j < k ==> Seq.index upd_s j == Seq.index new_s j)))
(ensures (forall (j:nat). j < Seq.length upd_s ==> Seq.index upd_s j == Seq.index new_s j))
(decreases %[(Seq.length upd_s) - k]) =
if k = Seq.length upd_s then ()
else begin
UV.sel_upd vb i k x h;
UV.as_seq_sel h vb k;
UV.as_seq_sel (UV.upd h vb i x) vb k;
aux (k+1)
end
in aux 0
let buffer_write #t b i v h =
if i < 0 || i >= buffer_length b then h else
begin
let view = uint_view t in
let db = get_downview b.bsrc in
let bv = UV.mk_buffer db view in
UV.upd_modifies (_ih h).hs bv i (v_of_typ t v);
UV.upd_equal_domains (_ih h).hs bv i (v_of_typ t v);
let hs' = UV.upd (_ih h).hs bv i (v_of_typ t v) in
let ih' = InteropHeap (_ih h).ptrs (_ih h).addrs hs' in
let mh' = Vale.Interop.down_mem ih' in
let h':vale_heap = ValeHeap mh' (Ghost.hide ih') h.heapletId in
seq_upd (_ih h).hs bv i (v_of_typ t v);
assert (Seq.equal (buffer_as_seq h' b) (Seq.upd (buffer_as_seq h b) i v));
h'
end
unfold let scale_t (t:base_typ) (index:int) : int = scale_by (view_n t) index
// Checks if address addr corresponds to one of the elements of buffer ptr
let addr_in_ptr (#t:base_typ) (addr:int) (ptr:buffer t) (h:vale_heap) : Ghost bool
(requires True)
(ensures fun b -> not b <==>
(forall (i:int).{:pattern (scale_t t i)} 0 <= i /\ i < buffer_length ptr ==>
addr <> (buffer_addr ptr h) + scale_t t i))
=
let n = buffer_length ptr in
let base = buffer_addr ptr h in
let rec aux (i:nat) : Tot (b:bool{not b <==> (forall j. i <= j /\ j < n ==>
addr <> base + scale_t t j)})
(decreases %[n-i]) =
if i >= n then false
else if addr = base + scale_t t i then true
else aux (i+1)
in aux 0
let valid_offset (t:base_typ) (n base:nat) (addr:int) (i:nat) =
exists j.{:pattern (scale_t t j)} i <= j /\ j < n /\ base + scale_t t j == addr
let rec get_addr_in_ptr (t:base_typ) (n base addr:nat) (i:nat) : Ghost nat
(requires valid_offset t n base addr i)
(ensures fun j -> base + scale_t t j == addr)
(decreases %[n - i])
=
if base + scale_t t i = addr then i
else get_addr_in_ptr t n base addr (i + 1)
let valid_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
DV.length (get_downview b.bsrc) % (view_n t) = 0 &&
addr_in_ptr #t addr b h
let writeable_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
valid_buffer t addr b h && b.writeable
#set-options "--max_fuel 1 --max_ifuel 1"
let sub_list (p1 p2:list 'a) = forall x. {:pattern List.memP x p2} List.memP x p1 ==> List.memP x p2
let rec valid_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b ->
b <==> (exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h)}
List.memP x ps /\ valid_buffer t addr x h))
=
match ps with
| [] -> false
| a::q -> valid_buffer t addr a h || valid_mem_aux t addr q h
let valid_mem (t:base_typ) addr (h:vale_heap) = valid_mem_aux t addr (_ih h).ptrs h
let valid_mem64 ptr h = valid_mem (TUInt64) ptr h
let rec find_valid_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o ->
match o with
| None -> not (valid_mem_aux t addr ps h)
| Some a -> valid_buffer t addr a h /\ List.memP a ps)
=
match ps with
| [] -> None
| a::q -> if valid_buffer t addr a h then Some a else find_valid_buffer_aux t addr q h
let find_valid_buffer (t:base_typ) (addr:int) (h:vale_heap) = find_valid_buffer_aux t addr (_ih h).ptrs h
let rec find_valid_buffer_aux_ps (t:base_typ) (addr:int) (ps:list b8) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs /\ sub_list ps (_ih h1).ptrs)
(ensures find_valid_buffer_aux t addr ps h1 == find_valid_buffer_aux t addr ps h2)
=
match ps with
| [] -> ()
| a::q -> find_valid_buffer_aux_ps t addr q h1 h2
let find_valid_buffer_ps (t:base_typ) (addr:int) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs)
(ensures find_valid_buffer t addr h1 == find_valid_buffer t addr h2)
=
find_valid_buffer_aux_ps t addr (_ih h1).ptrs h1 h2
let find_valid_buffer_valid_offset (t:base_typ) (addr:int) (h:vale_heap) : Lemma
(ensures (
match find_valid_buffer t addr h with
| None -> True
| Some a ->
let base = buffer_addr a h in
valid_offset t (buffer_length a) base addr 0
))
=
()
let rec writeable_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b -> b <==>
(exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h) \/ buffer_writeable x}
List.memP x ps /\ valid_buffer t addr x h /\ buffer_writeable x))
=
match ps with
| [] -> false
| a::q -> writeable_buffer t addr a h || writeable_mem_aux t addr q h
let writeable_mem (t:base_typ) addr (h:vale_heap) = writeable_mem_aux t addr (_ih h).ptrs h
let writeable_mem64 ptr h = writeable_mem (TUInt64) ptr h
let rec find_writeable_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o -> (
match o with
| None -> not (writeable_mem_aux t addr ps h)
| Some a -> writeable_buffer t addr a h /\ List.memP a ps
))
=
match ps with
| [] -> None
| a::q -> if writeable_buffer t addr a h then Some a else find_writeable_buffer_aux t addr q h
let find_writeable_buffer (t:base_typ) (addr:int) (h:vale_heap) =
find_writeable_buffer_aux t addr (_ih h).ptrs h
let load_mem (t:base_typ) (addr:int) (h:vale_heap) : GTot (base_typ_as_vale_type t) =
match find_valid_buffer t addr h with
| None -> default_of_typ t
| Some a ->
let base = buffer_addr a h in
buffer_read a (get_addr_in_ptr t (buffer_length a) base addr 0) h
let load_mem64 ptr h =
if not (valid_mem64 ptr h) then 0
else load_mem (TUInt64) ptr h
let length_t_eq (t:base_typ) (b:buffer t) :
Lemma (DV.length (get_downview b.bsrc) == buffer_length b * (view_n t)) =
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db (uint_view t) in
UV.length_eq ub;
assert (buffer_length b == DV.length db / (view_n t));
FStar.Math.Lib.lemma_div_def (DV.length db) (view_n t)
let get_addr_ptr (t:base_typ) (ptr:int) (h:vale_heap) : Ghost (buffer t)
(requires valid_mem t ptr h)
(ensures fun b -> List.memP b (_ih h).ptrs /\ valid_buffer t ptr b h)
=
Some?.v (find_valid_buffer t ptr h)
#reset-options "--max_fuel 0 --max_ifuel 0 --initial_fuel 0 --initial_ifuel 0 --z3rlimit 20"
let load_buffer_read (t:base_typ) (ptr:int) (h:vale_heap) : Lemma
(requires valid_mem t ptr h)
(ensures (
let b = get_addr_ptr t ptr h in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
load_mem t ptr h == buffer_read #t b i h
))
=
()
let store_mem (t:base_typ) (addr:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires True)
(ensures fun h1 -> (_ih h).addrs == (_ih h1).addrs /\ (_ih h).ptrs == (_ih h1).ptrs)
=
match find_writeable_buffer t addr h with
| None -> h
| Some a ->
let base = buffer_addr a h in
buffer_write a (get_addr_in_ptr t (buffer_length a) base addr 0) v h
let store_mem64 i v h =
if not (valid_mem64 i h) then h
else store_mem (TUInt64) i v h
let store_buffer_write
(t:base_typ)
(ptr:int)
(v:base_typ_as_vale_type t)
(h:vale_heap{writeable_mem t ptr h})
: Lemma
(ensures (
let b = Some?.v (find_writeable_buffer t ptr h) in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
store_mem t ptr v h == buffer_write b i v h
))
=
()
let valid_mem128 ptr h = valid_mem_aux (TUInt128) ptr (_ih h).ptrs h
let writeable_mem128 ptr h = writeable_mem_aux (TUInt128) ptr (_ih h).ptrs h
let load_mem128 ptr h =
if not (valid_mem128 ptr h) then (default_of_typ (TUInt128))
else load_mem (TUInt128) ptr h
let store_mem128 ptr v h =
if not (valid_mem128 ptr h) then h
else store_mem (TUInt128) ptr v h
let lemma_valid_mem64 b i h = ()
let lemma_writeable_mem64 b i h = ()
let lemma_store_mem (t:base_typ) (b:buffer t) (i:nat) (v:base_typ_as_vale_type t) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem t (buffer_addr b h + scale_t t i) v h == buffer_write b i v h
)
=
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
let view = uint_view t in
let addr = buffer_addr b h + scale_t t i in
match find_writeable_buffer t addr h with
| None -> ()
| Some a ->
let da = get_downview a.bsrc in
let db = get_downview b.bsrc in
UV.length_eq (UV.mk_buffer da view);
UV.length_eq (UV.mk_buffer db view);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.disjoint_or_eq_b8 a b);
assert (a == b)
let lemma_load_mem64 b i h =
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
let addr = buffer_addr b h + scale8 i in
let view = uint64_view in
match find_valid_buffer TUInt64 addr h with
| None -> ()
| Some a ->
let da = get_downview a.bsrc in
let db = get_downview b.bsrc in
UV.length_eq (UV.mk_buffer da view);
UV.length_eq (UV.mk_buffer db view);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.disjoint_or_eq_b8 a b);
assert (a == b)
let lemma_store_mem64 b i v h = lemma_store_mem TUInt64 b i v h
let lemma_valid_mem128 b i h = ()
let lemma_writeable_mem128 b i h = ()
let lemma_load_mem128 b i h =
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
let addr = buffer_addr b h + scale16 i in
let view = uint128_view in
match find_valid_buffer TUInt128 addr h with
| None -> ()
| Some a ->
let da = get_downview a.bsrc in
let db = get_downview b.bsrc in
UV.length_eq (UV.mk_buffer da view);
UV.length_eq (UV.mk_buffer db view);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.disjoint_or_eq_b8 a b);
assert (a == b)
let lemma_store_mem128 b i v h = lemma_store_mem TUInt128 b i v h
open Vale.X64.Machine_s
let valid_taint_b8 (b:b8) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
let addr = (_ih h).addrs b in
(forall (i:int).{:pattern (mt.[i])}
addr <= i /\ i < addr + DV.length (get_downview b.bsrc) ==> mt.[i] == tn)
let valid_taint_buf #t b h mt tn =
valid_taint_b8 b h mt tn
let apply_taint_buf (#t:base_typ) (b:buffer t) (mem:vale_heap) (memTaint:memtaint) (tn:taint) (i:nat) : Lemma
(requires i < DV.length (get_downview b.bsrc) /\ valid_taint_buf b mem memTaint tn)
(ensures memTaint.[(_ih mem).addrs b + i] == tn)
=
()
let lemma_valid_taint64 b memTaint mem i t =
length_t_eq (TUInt64) b;
let ptr = buffer_addr b mem + scale8 i in
let aux (i':nat) : Lemma
(requires i' >= ptr /\ i' < ptr + 8)
(ensures memTaint.[i'] == t) =
let extra = scale8 i + i' - ptr in
assert (i' == (_ih mem).addrs b + extra);
apply_taint_buf b mem memTaint t extra
in
Classical.forall_intro (Classical.move_requires aux)
let lemma_valid_taint128 b memTaint mem i t =
length_t_eq (TUInt128) b;
let ptr = buffer_addr b mem + scale16 i in
let aux i' : Lemma
(requires i' >= ptr /\ i' < ptr + 16)
(ensures memTaint.[i'] == t) =
let extra = scale16 i + i' - ptr in
assert (i' == (_ih mem).addrs b + extra);
apply_taint_buf b mem memTaint t extra
in
Classical.forall_intro (Classical.move_requires aux)
let same_memTaint (t:base_typ) (b:buffer t) (mem0 mem1:vale_heap) (memT0 memT1:memtaint) : Lemma
(requires modifies (loc_buffer b) mem0 mem1 /\
(forall p. Map.sel memT0 p == Map.sel memT1 p))
(ensures memT0 == memT1) =
assert (Map.equal memT0 memT1)
let same_memTaint64 b mem0 mem1 memtaint0 memtaint1 =
same_memTaint (TUInt64) b mem0 mem1 memtaint0 memtaint1
let same_memTaint128 b mem0 mem1 memtaint0 memtaint1 =
same_memTaint (TUInt128) b mem0 mem1 memtaint0 memtaint1
let modifies_valid_taint #t b p h h' mt tn =
let dv = get_downview b.bsrc in
let imp_left () : Lemma
(requires valid_taint_buf b h mt tn)
(ensures valid_taint_buf b h' mt tn) =
let aux (i:nat{i < DV.length dv}) : Lemma (mt.[(_ih h').addrs b + i] = tn) =
apply_taint_buf b h mt tn i
in Classical.forall_intro aux
in let imp_right () : Lemma
(requires valid_taint_buf b h' mt tn)
(ensures valid_taint_buf b h mt tn) =
let aux (i:nat{i < DV.length dv}) : Lemma (mt.[(_ih h).addrs b + i] = tn) =
apply_taint_buf b h' mt tn i
in Classical.forall_intro aux
in
(Classical.move_requires imp_left());
(Classical.move_requires imp_right())
#set-options "--initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let modifies_same_heaplet_id l h1 h2 =
()
let valid_taint_bufs (mem:vale_heap) (memTaint:memtaint) (ps:list b8) (ts:b8 -> GTot taint) =
forall b.{:pattern List.memP b ps} List.memP b ps ==> valid_taint_b8 b mem memTaint (ts b)
let rec write_taint_lemma (i:nat) (mem:IB.interop_heap) (ts:b8 -> GTot taint) (b:b8) (accu:memtaint) : Lemma
(requires
i <= DV.length (get_downview b.bsrc) /\
(forall (j:int).{:pattern accu.[j]} mem.addrs b <= j /\ j < mem.addrs b + i ==> accu.[j] = ts b)
)
(ensures (
let m = IB.write_taint i mem ts b accu in
let addr = mem.addrs b in
(forall j.{:pattern m.[j]} addr <= j /\ j < addr + DV.length (get_downview b.bsrc) ==>
m.[j] = ts b) /\
(forall j. {:pattern m.[j]} j < addr \/ j >= addr + DV.length (get_downview b.bsrc) ==>
m.[j] == accu.[j])))
(decreases %[DV.length (get_downview b.bsrc) - i])
=
let m = IB.write_taint i mem ts b accu in
let addr = mem.addrs b in
if i >= DV.length (get_downview b.bsrc) then ()
else
let new_accu = accu.[addr+i] <- ts b in
assert (IB.write_taint i mem ts b accu == IB.write_taint (i + 1) mem ts b new_accu);
assert (Set.equal (Map.domain new_accu) (Set.complement Set.empty));
assert (forall j.{:pattern m.[j]} addr <= j /\ j < addr + i + 1 ==> new_accu.[j] == ts b);
write_taint_lemma (i + 1) mem ts b new_accu
#restart-solver
let rec valid_memtaint (mem:vale_heap) (ps:list b8) (ts:b8 -> GTot taint) : Lemma
(requires IB.list_disjoint_or_eq ps)
(ensures valid_taint_bufs mem (IB.create_memtaint (_ih mem) ps ts) ps ts)
=
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
match ps with
| [] -> ()
| b :: q ->
assert (List.memP b ps);
assert (forall i. {:pattern List.memP i q} List.memP i q ==> List.memP i ps);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.list_disjoint_or_eq q);
valid_memtaint mem q ts;
assert (IB.create_memtaint (_ih mem) ps ts ==
IB.write_taint 0 (_ih mem) ts b (IB.create_memtaint (_ih mem) q ts));
write_taint_lemma 0 (_ih mem) ts b (IB.create_memtaint (_ih mem) q ts);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (forall p. List.memP p q ==> IB.disjoint_or_eq_b8 p b)
let valid_layout_data_buffer (t:base_typ) (b:buffer t) (layout:vale_heap_layout_inner) (hid:heaplet_id) (write:bool) =
exists (n:nat).{:pattern (Seq.index layout.vl_buffers n)} n < Seq.length layout.vl_buffers /\ (
let bi = Seq.index layout.vl_buffers n in
t == bi.bi_typ /\
b == bi.bi_buffer /\
(write ==> bi.bi_mutable == Mutable) /\
hid == bi.bi_heaplet)
[@"opaque_to_smt"]
let valid_layout_buffer_id t b layout h_id write =
match h_id with
| None -> True
| Some hid ->
layout.vl_inner.vl_heaplets_initialized /\
valid_layout_data_buffer t b layout.vl_inner hid write
let inv_heaplet_ids (hs:vale_heaplets) =
forall (i:heaplet_id).{:pattern Map16.sel hs i} (Map16.sel hs i).heapletId == Some i
let inv_heaplet (owns:Set.set int) (h hi:vale_heap) =
h.ih.IB.ptrs == hi.ih.IB.ptrs /\
Map.domain h.mh == Map.domain hi.mh /\
(forall (i:int).{:pattern Set.mem i owns \/ Set.mem i (Map.domain h.mh) \/ Map.sel h.mh i \/ Map.sel hi.mh i}
Set.mem i owns ==>
Set.mem i (Map.domain h.mh) /\
Map.sel h.mh i == Map.sel hi.mh i /\
True
) /\
True
// heaplet state matches heap state
let inv_buffer_info (bi:buffer_info) (owners:heaplet_id -> Set.set int) (h:vale_heap) (hs:vale_heaplets) (mt:memTaint_t) (modloc:loc) =
let t = bi.bi_typ in
let hid = bi.bi_heaplet in
let hi = Map16.get hs hid in
let b = bi.bi_buffer in
let owns = owners hid in
(bi.bi_mutable == Mutable ==> loc_includes modloc (loc_buffer b)) /\
buffer_readable h b /\
buffer_as_seq hi b == buffer_as_seq h b /\
(valid_taint_buf b hi mt bi.bi_taint <==> valid_taint_buf b h mt bi.bi_taint) /\
(forall (i:int).{:pattern Set.mem i owns}
buffer_addr b h <= i /\ i < buffer_addr b h + DV.length (get_downview b.bsrc) ==> Set.mem i owns) /\
True
let inv_heaplets (layout:vale_heap_layout_inner) (h:vale_heap) (hs:vale_heaplets) (mt:memTaint_t) =
let bs = layout.vl_buffers in
modifies layout.vl_mod_loc layout.vl_old_heap h /\ // modifies for entire heap
(forall (i:heaplet_id) (a:int).{:pattern Set.mem a (layout.vl_heaplet_sets i)}
layout.vl_heaplet_map a == Some i <==> Set.mem a (layout.vl_heaplet_sets i)
) /\
(forall (i:heaplet_id).{:pattern (Map16.sel hs i)}
inv_heaplet (layout.vl_heaplet_sets i) h (Map16.sel hs i)) /\
(forall (i:nat).{:pattern (Seq.index bs i)} i < Seq.length bs ==>
inv_buffer_info (Seq.index bs i) layout.vl_heaplet_sets h hs mt layout.vl_mod_loc) /\
(forall (i1 i2:nat).{:pattern (Seq.index bs i1); (Seq.index bs i2)}
i1 < Seq.length bs /\ i2 < Seq.length bs ==> buffer_info_disjoint (Seq.index bs i1) (Seq.index bs i2)) /\
True
let is_initial_heap layout h =
h == layout.vl_inner.vl_old_heap /\
not layout.vl_inner.vl_heaplets_initialized
let mem_inv h =
h.vf_heap.heapletId == None /\
inv_heaplet_ids h.vf_heaplets /\
(if h.vf_layout.vl_inner.vl_heaplets_initialized
then
inv_heaplets h.vf_layout.vl_inner h.vf_heap
h.vf_heaplets h.vf_layout.vl_taint
else
h.vf_heaplets == empty_vale_heaplets h.vf_layout.vl_inner.vl_old_heap
) | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": 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": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val layout_heaplets_initialized (layout:vale_heap_layout_inner) : bool | [] | Vale.X64.Memory.layout_heaplets_initialized | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | layout: Vale.Arch.HeapImpl.vale_heap_layout_inner -> Prims.bool | {
"end_col": 71,
"end_line": 753,
"start_col": 41,
"start_line": 753
} |
Prims.Tot | val layout_old_heap (layout:vale_heap_layout_inner) : vale_heap | [
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let layout_old_heap layout = layout.vl_old_heap | val layout_old_heap (layout:vale_heap_layout_inner) : vale_heap
let layout_old_heap layout = | false | null | false | layout.vl_old_heap | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"Vale.Arch.HeapImpl.vale_heap_layout_inner",
"Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout_inner__item__vl_old_heap",
"Vale.Arch.HeapImpl.vale_heap"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32
let uint64_view = Vale.Interop.Views.up_view64
let uint128_view = Vale.Interop.Views.up_view128
let uint_view (t:base_typ) : (v:UV.view UInt8.t (IB.base_typ_as_type t){UV.View?.n v == view_n t}) =
match t with
| TUInt8 -> uint8_view
| TUInt16 -> uint16_view
| TUInt32 -> uint32_view
| TUInt64 -> uint64_view
| TUInt128 -> uint128_view
let buffer_as_seq #t h b =
let s = UV.as_seq (IB.hs_of_mem (_ih h)) (UV.mk_buffer (get_downview b.bsrc) (uint_view t)) in
Vale.Lib.Seqs_s.seq_map (v_to_typ t) s
let buffer_readable #t h b = List.memP b (IB.ptrs_of_mem (_ih h))
let buffer_writeable #t b = b.writeable
let buffer_length #t b = UV.length (UV.mk_buffer (get_downview b.bsrc) (uint_view t))
let loc = M.loc
let loc_none = M.loc_none
let loc_union = M.loc_union
let loc_buffer #t b = M.loc_buffer b.bsrc
let loc_disjoint = M.loc_disjoint
let loc_includes = M.loc_includes
let modifies s h h' =
M.modifies s (_ih h).hs (_ih h').hs /\
h.heapletId == h'.heapletId /\
(_ih h).ptrs == (_ih h').ptrs /\
(_ih h).addrs == (_ih h').addrs /\
HST.equal_domains (_ih h).hs (_ih h').hs
let buffer_addr #t b h = IB.addrs_of_mem (_ih h) b
open FStar.Mul
#set-options "--z3rlimit 20"
let index64_heap_aux (s:Seq.lseq UInt8.t 8) (heap:S.machine_heap) (ptr:int) : Lemma
(requires forall (j:nat{j < 8}). UInt8.v (Seq.index s j) == heap.[ptr+j])
(ensures UInt64.v (Vale.Interop.Views.get64 s) == S.get_heap_val64 ptr heap) =
let open Vale.Def.Words.Seq_s in
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
Vale.Interop.Views.get64_reveal ();
S.get_heap_val64_reveal ();
Vale.Def.Types_s.le_bytes_to_nat64_reveal ()
let index_helper (x y:int) (heap:S.machine_heap) : Lemma
(requires x == y)
(ensures heap.[x] == heap.[y])
=
()
let index_mul_helper (addr i n j:int) : Lemma
(addr + (i * n + j) == addr + n * i + j) =
()
#set-options "--max_fuel 0 --max_ifuel 0"
let index64_get_heap_val64
(h:vale_heap)
(b:buffer64{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma (Seq.index (buffer_as_seq h b) i == S.get_heap_val64 (buffer_addr b h + scale8 i) heap)
=
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db uint64_view in
let ptr = buffer_addr b h + scale8 i in
let s = DV.as_seq (_ih h).hs db in
let t = TUInt64 in
let addr = buffer_addr b h in
UV.length_eq ub;
UV.as_seq_sel (_ih h).hs ub i;
UV.get_sel (_ih h).hs ub i;
let s' = Seq.slice s (i*8) (i*8 + 8) in
let aux (j:nat{j < 8}) : Lemma (UInt8.v (Seq.index s' j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*8 + j)) == heap.[addr + (i*8+j)]);
Seq.lemma_index_slice s (i*8) (i*8+8) j;
assert (UInt8.v (Seq.index s' j) == heap.[addr+(i*8+j)]);
index_mul_helper addr i 8 j;
()
in Classical.forall_intro aux;
index64_heap_aux s' heap ptr
#set-options "--z3rlimit 50"
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Four_s
open Vale.Lib.Seqs_s
let index128_get_heap_val128_aux (s:Seq.lseq UInt8.t 16) (ptr:int) (heap:S.machine_heap) : Lemma
(requires (forall (j:nat) . j < 16 ==> UInt8.v (Seq.index s j) == heap.[ptr+j]))
(ensures Vale.Interop.Views.get128 s == Mkfour
(S.get_heap_val32 ptr heap)
(S.get_heap_val32 (ptr+4) heap)
(S.get_heap_val32 (ptr+8) heap)
(S.get_heap_val32 (ptr+12) heap)) =
reveal_opaque (`%seq_to_seq_four_LE) (seq_to_seq_four_LE #nat8);
S.get_heap_val32_reveal ();
Vale.Interop.Views.get128_reveal ();
Vale.Def.Types_s.le_bytes_to_quad32_reveal ()
let index128_get_heap_val128
(h:vale_heap)
(b:buffer128{List.memP b (_ih h).ptrs})
(heap:S.machine_heap{IB.correct_down (_ih h) heap})
(i:nat{i < buffer_length b})
: Lemma
(ensures (
let addr = buffer_addr b h in
Seq.index (buffer_as_seq h b) i ==
Mkfour
(S.get_heap_val32 (addr + scale16 i) heap)
(S.get_heap_val32 (addr + scale16 i+4) heap)
(S.get_heap_val32 (addr + scale16 i+8) heap)
(S.get_heap_val32 (addr + scale16 i +12) heap)
))
=
let db = get_downview b.bsrc in
let vb = UV.mk_buffer db uint128_view in
let ptr = buffer_addr b h + scale16 i in
let s = DV.as_seq (_ih h).hs db in
let addr = buffer_addr b h in
UV.length_eq vb;
UV.as_seq_sel (_ih h).hs vb i;
UV.get_sel (_ih h).hs vb i;
let sl = Seq.slice s (i*16) (i*16+16) in
let aux (j:nat{j < 16}) : Lemma (UInt8.v (Seq.index sl j) == heap.[ptr+j]) =
assert (UInt8.v (Seq.index s (i*16 + j)) == heap.[addr + (i*16+j)]);
Seq.lemma_index_slice s (i*16) (i*16+16) j;
assert (UInt8.v (Seq.index sl j) == heap.[addr+(i*16+j)]);
index_mul_helper addr i 16 j
in Classical.forall_intro aux;
index128_get_heap_val128_aux sl ptr heap
let modifies_goal_directed s h1 h2 = modifies s h1 h2
let lemma_modifies_goal_directed s h1 h2 = ()
let buffer_length_buffer_as_seq #t h b = ()
let same_underlying_seq (#t:base_typ) (h1 h2:vale_heap) (b:buffer t) : Lemma
(requires Seq.equal (DV.as_seq (_ih h1).hs (get_downview b.bsrc)) (DV.as_seq (_ih h2).hs (get_downview b.bsrc)))
(ensures Seq.equal (buffer_as_seq h1 b) (buffer_as_seq h2 b))
=
let db = get_downview b.bsrc in
let rec aux (i:nat{i <= buffer_length b}) : Lemma
(requires (forall (j:nat{j < i}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j) /\
(Seq.equal (DV.as_seq (_ih h1).hs db) (DV.as_seq (_ih h2).hs db)))
(ensures (forall (j:nat{j < buffer_length b}). Seq.index (buffer_as_seq h1 b) j == Seq.index (buffer_as_seq h2 b) j))
(decreases %[(buffer_length b) - i]) =
if i = buffer_length b then ()
else (
let bv = UV.mk_buffer db (uint_view t) in
UV.get_sel (_ih h1).hs bv i;
UV.get_sel (_ih h2).hs bv i;
UV.as_seq_sel (_ih h1).hs bv i;
UV.as_seq_sel (_ih h2).hs bv i;
aux (i+1)
)
in aux 0
let modifies_buffer_elim #t1 b p h h' =
let db = get_downview b.bsrc in
lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;
same_underlying_seq h h' b;
assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))
let modifies_buffer_addr #t b p h h' = ()
let modifies_buffer_readable #t b p h h' = ()
let loc_disjoint_none_r s = M.loc_disjoint_none_r s
let loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2
let loc_includes_refl s = M.loc_includes_refl s
let loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3
let loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2
let loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s
let loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)
let loc_includes_none s = M.loc_includes_none s
let modifies_refl s h = M.modifies_refl s (_ih h).hs
let modifies_goal_directed_refl s h = M.modifies_refl s (_ih h).hs
let modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2
let modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs
let modifies_goal_directed_trans s12 h1 h2 s13 h3 =
modifies_trans s12 h1 h2 s13 h3;
modifies_loc_includes s13 h1 h3 (loc_union s12 s13);
()
let modifies_goal_directed_trans2 s12 h1 h2 s13 h3 = modifies_goal_directed_trans s12 h1 h2 s13 h3
let default_of_typ (t:base_typ) : base_typ_as_vale_type t =
allow_inversion base_typ;
match t with
| TUInt8 -> 0
| TUInt16 -> 0
| TUInt32 -> 0
| TUInt64 -> 0
| TUInt128 -> Vale.Def.Words_s.Mkfour #nat32 0 0 0 0
let buffer_read #t b i h =
if i < 0 || i >= buffer_length b then default_of_typ t else
Seq.index (buffer_as_seq h b) i
let seq_upd
(#b:_)
(h:HS.mem)
(vb:UV.buffer b{UV.live h vb})
(i:nat{i < UV.length vb})
(x:b)
: Lemma
(Seq.equal
(Seq.upd (UV.as_seq h vb) i x)
(UV.as_seq (UV.upd h vb i x) vb))
=
let old_s = UV.as_seq h vb in
let new_s = UV.as_seq (UV.upd h vb i x) vb in
let upd_s = Seq.upd old_s i x in
let rec aux (k:nat) : Lemma
(requires (k <= Seq.length upd_s /\ (forall (j:nat). j < k ==> Seq.index upd_s j == Seq.index new_s j)))
(ensures (forall (j:nat). j < Seq.length upd_s ==> Seq.index upd_s j == Seq.index new_s j))
(decreases %[(Seq.length upd_s) - k]) =
if k = Seq.length upd_s then ()
else begin
UV.sel_upd vb i k x h;
UV.as_seq_sel h vb k;
UV.as_seq_sel (UV.upd h vb i x) vb k;
aux (k+1)
end
in aux 0
let buffer_write #t b i v h =
if i < 0 || i >= buffer_length b then h else
begin
let view = uint_view t in
let db = get_downview b.bsrc in
let bv = UV.mk_buffer db view in
UV.upd_modifies (_ih h).hs bv i (v_of_typ t v);
UV.upd_equal_domains (_ih h).hs bv i (v_of_typ t v);
let hs' = UV.upd (_ih h).hs bv i (v_of_typ t v) in
let ih' = InteropHeap (_ih h).ptrs (_ih h).addrs hs' in
let mh' = Vale.Interop.down_mem ih' in
let h':vale_heap = ValeHeap mh' (Ghost.hide ih') h.heapletId in
seq_upd (_ih h).hs bv i (v_of_typ t v);
assert (Seq.equal (buffer_as_seq h' b) (Seq.upd (buffer_as_seq h b) i v));
h'
end
unfold let scale_t (t:base_typ) (index:int) : int = scale_by (view_n t) index
// Checks if address addr corresponds to one of the elements of buffer ptr
let addr_in_ptr (#t:base_typ) (addr:int) (ptr:buffer t) (h:vale_heap) : Ghost bool
(requires True)
(ensures fun b -> not b <==>
(forall (i:int).{:pattern (scale_t t i)} 0 <= i /\ i < buffer_length ptr ==>
addr <> (buffer_addr ptr h) + scale_t t i))
=
let n = buffer_length ptr in
let base = buffer_addr ptr h in
let rec aux (i:nat) : Tot (b:bool{not b <==> (forall j. i <= j /\ j < n ==>
addr <> base + scale_t t j)})
(decreases %[n-i]) =
if i >= n then false
else if addr = base + scale_t t i then true
else aux (i+1)
in aux 0
let valid_offset (t:base_typ) (n base:nat) (addr:int) (i:nat) =
exists j.{:pattern (scale_t t j)} i <= j /\ j < n /\ base + scale_t t j == addr
let rec get_addr_in_ptr (t:base_typ) (n base addr:nat) (i:nat) : Ghost nat
(requires valid_offset t n base addr i)
(ensures fun j -> base + scale_t t j == addr)
(decreases %[n - i])
=
if base + scale_t t i = addr then i
else get_addr_in_ptr t n base addr (i + 1)
let valid_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
DV.length (get_downview b.bsrc) % (view_n t) = 0 &&
addr_in_ptr #t addr b h
let writeable_buffer (t:base_typ) (addr:int) (b:b8) (h:vale_heap) : GTot bool =
valid_buffer t addr b h && b.writeable
#set-options "--max_fuel 1 --max_ifuel 1"
let sub_list (p1 p2:list 'a) = forall x. {:pattern List.memP x p2} List.memP x p1 ==> List.memP x p2
let rec valid_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b ->
b <==> (exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h)}
List.memP x ps /\ valid_buffer t addr x h))
=
match ps with
| [] -> false
| a::q -> valid_buffer t addr a h || valid_mem_aux t addr q h
let valid_mem (t:base_typ) addr (h:vale_heap) = valid_mem_aux t addr (_ih h).ptrs h
let valid_mem64 ptr h = valid_mem (TUInt64) ptr h
let rec find_valid_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o ->
match o with
| None -> not (valid_mem_aux t addr ps h)
| Some a -> valid_buffer t addr a h /\ List.memP a ps)
=
match ps with
| [] -> None
| a::q -> if valid_buffer t addr a h then Some a else find_valid_buffer_aux t addr q h
let find_valid_buffer (t:base_typ) (addr:int) (h:vale_heap) = find_valid_buffer_aux t addr (_ih h).ptrs h
let rec find_valid_buffer_aux_ps (t:base_typ) (addr:int) (ps:list b8) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs /\ sub_list ps (_ih h1).ptrs)
(ensures find_valid_buffer_aux t addr ps h1 == find_valid_buffer_aux t addr ps h2)
=
match ps with
| [] -> ()
| a::q -> find_valid_buffer_aux_ps t addr q h1 h2
let find_valid_buffer_ps (t:base_typ) (addr:int) (h1:vale_heap) (h2:vale_heap) : Lemma
(requires (_ih h1).ptrs == (_ih h2).ptrs)
(ensures find_valid_buffer t addr h1 == find_valid_buffer t addr h2)
=
find_valid_buffer_aux_ps t addr (_ih h1).ptrs h1 h2
let find_valid_buffer_valid_offset (t:base_typ) (addr:int) (h:vale_heap) : Lemma
(ensures (
match find_valid_buffer t addr h with
| None -> True
| Some a ->
let base = buffer_addr a h in
valid_offset t (buffer_length a) base addr 0
))
=
()
let rec writeable_mem_aux (t:base_typ) addr (ps:list b8) (h:vale_heap) : Ghost bool
(requires sub_list ps (_ih h).ptrs)
(ensures fun b -> b <==>
(exists (x:buffer t). {:pattern (List.memP x ps) \/ (valid_buffer t addr x h) \/ buffer_writeable x}
List.memP x ps /\ valid_buffer t addr x h /\ buffer_writeable x))
=
match ps with
| [] -> false
| a::q -> writeable_buffer t addr a h || writeable_mem_aux t addr q h
let writeable_mem (t:base_typ) addr (h:vale_heap) = writeable_mem_aux t addr (_ih h).ptrs h
let writeable_mem64 ptr h = writeable_mem (TUInt64) ptr h
let rec find_writeable_buffer_aux (t:base_typ) (addr:int) (ps:list b8) (h:vale_heap) : Ghost (option (buffer t))
(requires sub_list ps (_ih h).ptrs)
(ensures fun o -> (
match o with
| None -> not (writeable_mem_aux t addr ps h)
| Some a -> writeable_buffer t addr a h /\ List.memP a ps
))
=
match ps with
| [] -> None
| a::q -> if writeable_buffer t addr a h then Some a else find_writeable_buffer_aux t addr q h
let find_writeable_buffer (t:base_typ) (addr:int) (h:vale_heap) =
find_writeable_buffer_aux t addr (_ih h).ptrs h
let load_mem (t:base_typ) (addr:int) (h:vale_heap) : GTot (base_typ_as_vale_type t) =
match find_valid_buffer t addr h with
| None -> default_of_typ t
| Some a ->
let base = buffer_addr a h in
buffer_read a (get_addr_in_ptr t (buffer_length a) base addr 0) h
let load_mem64 ptr h =
if not (valid_mem64 ptr h) then 0
else load_mem (TUInt64) ptr h
let length_t_eq (t:base_typ) (b:buffer t) :
Lemma (DV.length (get_downview b.bsrc) == buffer_length b * (view_n t)) =
let db = get_downview b.bsrc in
let ub = UV.mk_buffer db (uint_view t) in
UV.length_eq ub;
assert (buffer_length b == DV.length db / (view_n t));
FStar.Math.Lib.lemma_div_def (DV.length db) (view_n t)
let get_addr_ptr (t:base_typ) (ptr:int) (h:vale_heap) : Ghost (buffer t)
(requires valid_mem t ptr h)
(ensures fun b -> List.memP b (_ih h).ptrs /\ valid_buffer t ptr b h)
=
Some?.v (find_valid_buffer t ptr h)
#reset-options "--max_fuel 0 --max_ifuel 0 --initial_fuel 0 --initial_ifuel 0 --z3rlimit 20"
let load_buffer_read (t:base_typ) (ptr:int) (h:vale_heap) : Lemma
(requires valid_mem t ptr h)
(ensures (
let b = get_addr_ptr t ptr h in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
load_mem t ptr h == buffer_read #t b i h
))
=
()
let store_mem (t:base_typ) (addr:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires True)
(ensures fun h1 -> (_ih h).addrs == (_ih h1).addrs /\ (_ih h).ptrs == (_ih h1).ptrs)
=
match find_writeable_buffer t addr h with
| None -> h
| Some a ->
let base = buffer_addr a h in
buffer_write a (get_addr_in_ptr t (buffer_length a) base addr 0) v h
let store_mem64 i v h =
if not (valid_mem64 i h) then h
else store_mem (TUInt64) i v h
let store_buffer_write
(t:base_typ)
(ptr:int)
(v:base_typ_as_vale_type t)
(h:vale_heap{writeable_mem t ptr h})
: Lemma
(ensures (
let b = Some?.v (find_writeable_buffer t ptr h) in
let i = get_addr_in_ptr t (buffer_length b) (buffer_addr b h) ptr 0 in
store_mem t ptr v h == buffer_write b i v h
))
=
()
let valid_mem128 ptr h = valid_mem_aux (TUInt128) ptr (_ih h).ptrs h
let writeable_mem128 ptr h = writeable_mem_aux (TUInt128) ptr (_ih h).ptrs h
let load_mem128 ptr h =
if not (valid_mem128 ptr h) then (default_of_typ (TUInt128))
else load_mem (TUInt128) ptr h
let store_mem128 ptr v h =
if not (valid_mem128 ptr h) then h
else store_mem (TUInt128) ptr v h
let lemma_valid_mem64 b i h = ()
let lemma_writeable_mem64 b i h = ()
let lemma_store_mem (t:base_typ) (b:buffer t) (i:nat) (v:base_typ_as_vale_type t) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem t (buffer_addr b h + scale_t t i) v h == buffer_write b i v h
)
=
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
let view = uint_view t in
let addr = buffer_addr b h + scale_t t i in
match find_writeable_buffer t addr h with
| None -> ()
| Some a ->
let da = get_downview a.bsrc in
let db = get_downview b.bsrc in
UV.length_eq (UV.mk_buffer da view);
UV.length_eq (UV.mk_buffer db view);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.disjoint_or_eq_b8 a b);
assert (a == b)
let lemma_load_mem64 b i h =
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
let addr = buffer_addr b h + scale8 i in
let view = uint64_view in
match find_valid_buffer TUInt64 addr h with
| None -> ()
| Some a ->
let da = get_downview a.bsrc in
let db = get_downview b.bsrc in
UV.length_eq (UV.mk_buffer da view);
UV.length_eq (UV.mk_buffer db view);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.disjoint_or_eq_b8 a b);
assert (a == b)
let lemma_store_mem64 b i v h = lemma_store_mem TUInt64 b i v h
let lemma_valid_mem128 b i h = ()
let lemma_writeable_mem128 b i h = ()
let lemma_load_mem128 b i h =
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
let addr = buffer_addr b h + scale16 i in
let view = uint128_view in
match find_valid_buffer TUInt128 addr h with
| None -> ()
| Some a ->
let da = get_downview a.bsrc in
let db = get_downview b.bsrc in
UV.length_eq (UV.mk_buffer da view);
UV.length_eq (UV.mk_buffer db view);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.disjoint_or_eq_b8 a b);
assert (a == b)
let lemma_store_mem128 b i v h = lemma_store_mem TUInt128 b i v h
open Vale.X64.Machine_s
let valid_taint_b8 (b:b8) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
let addr = (_ih h).addrs b in
(forall (i:int).{:pattern (mt.[i])}
addr <= i /\ i < addr + DV.length (get_downview b.bsrc) ==> mt.[i] == tn)
let valid_taint_buf #t b h mt tn =
valid_taint_b8 b h mt tn
let apply_taint_buf (#t:base_typ) (b:buffer t) (mem:vale_heap) (memTaint:memtaint) (tn:taint) (i:nat) : Lemma
(requires i < DV.length (get_downview b.bsrc) /\ valid_taint_buf b mem memTaint tn)
(ensures memTaint.[(_ih mem).addrs b + i] == tn)
=
()
let lemma_valid_taint64 b memTaint mem i t =
length_t_eq (TUInt64) b;
let ptr = buffer_addr b mem + scale8 i in
let aux (i':nat) : Lemma
(requires i' >= ptr /\ i' < ptr + 8)
(ensures memTaint.[i'] == t) =
let extra = scale8 i + i' - ptr in
assert (i' == (_ih mem).addrs b + extra);
apply_taint_buf b mem memTaint t extra
in
Classical.forall_intro (Classical.move_requires aux)
let lemma_valid_taint128 b memTaint mem i t =
length_t_eq (TUInt128) b;
let ptr = buffer_addr b mem + scale16 i in
let aux i' : Lemma
(requires i' >= ptr /\ i' < ptr + 16)
(ensures memTaint.[i'] == t) =
let extra = scale16 i + i' - ptr in
assert (i' == (_ih mem).addrs b + extra);
apply_taint_buf b mem memTaint t extra
in
Classical.forall_intro (Classical.move_requires aux)
let same_memTaint (t:base_typ) (b:buffer t) (mem0 mem1:vale_heap) (memT0 memT1:memtaint) : Lemma
(requires modifies (loc_buffer b) mem0 mem1 /\
(forall p. Map.sel memT0 p == Map.sel memT1 p))
(ensures memT0 == memT1) =
assert (Map.equal memT0 memT1)
let same_memTaint64 b mem0 mem1 memtaint0 memtaint1 =
same_memTaint (TUInt64) b mem0 mem1 memtaint0 memtaint1
let same_memTaint128 b mem0 mem1 memtaint0 memtaint1 =
same_memTaint (TUInt128) b mem0 mem1 memtaint0 memtaint1
let modifies_valid_taint #t b p h h' mt tn =
let dv = get_downview b.bsrc in
let imp_left () : Lemma
(requires valid_taint_buf b h mt tn)
(ensures valid_taint_buf b h' mt tn) =
let aux (i:nat{i < DV.length dv}) : Lemma (mt.[(_ih h').addrs b + i] = tn) =
apply_taint_buf b h mt tn i
in Classical.forall_intro aux
in let imp_right () : Lemma
(requires valid_taint_buf b h' mt tn)
(ensures valid_taint_buf b h mt tn) =
let aux (i:nat{i < DV.length dv}) : Lemma (mt.[(_ih h).addrs b + i] = tn) =
apply_taint_buf b h' mt tn i
in Classical.forall_intro aux
in
(Classical.move_requires imp_left());
(Classical.move_requires imp_right())
#set-options "--initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let modifies_same_heaplet_id l h1 h2 =
()
let valid_taint_bufs (mem:vale_heap) (memTaint:memtaint) (ps:list b8) (ts:b8 -> GTot taint) =
forall b.{:pattern List.memP b ps} List.memP b ps ==> valid_taint_b8 b mem memTaint (ts b)
let rec write_taint_lemma (i:nat) (mem:IB.interop_heap) (ts:b8 -> GTot taint) (b:b8) (accu:memtaint) : Lemma
(requires
i <= DV.length (get_downview b.bsrc) /\
(forall (j:int).{:pattern accu.[j]} mem.addrs b <= j /\ j < mem.addrs b + i ==> accu.[j] = ts b)
)
(ensures (
let m = IB.write_taint i mem ts b accu in
let addr = mem.addrs b in
(forall j.{:pattern m.[j]} addr <= j /\ j < addr + DV.length (get_downview b.bsrc) ==>
m.[j] = ts b) /\
(forall j. {:pattern m.[j]} j < addr \/ j >= addr + DV.length (get_downview b.bsrc) ==>
m.[j] == accu.[j])))
(decreases %[DV.length (get_downview b.bsrc) - i])
=
let m = IB.write_taint i mem ts b accu in
let addr = mem.addrs b in
if i >= DV.length (get_downview b.bsrc) then ()
else
let new_accu = accu.[addr+i] <- ts b in
assert (IB.write_taint i mem ts b accu == IB.write_taint (i + 1) mem ts b new_accu);
assert (Set.equal (Map.domain new_accu) (Set.complement Set.empty));
assert (forall j.{:pattern m.[j]} addr <= j /\ j < addr + i + 1 ==> new_accu.[j] == ts b);
write_taint_lemma (i + 1) mem ts b new_accu
#restart-solver
let rec valid_memtaint (mem:vale_heap) (ps:list b8) (ts:b8 -> GTot taint) : Lemma
(requires IB.list_disjoint_or_eq ps)
(ensures valid_taint_bufs mem (IB.create_memtaint (_ih mem) ps ts) ps ts)
=
FStar.Pervasives.reveal_opaque (`%addr_map_pred) addr_map_pred;
match ps with
| [] -> ()
| b :: q ->
assert (List.memP b ps);
assert (forall i. {:pattern List.memP i q} List.memP i q ==> List.memP i ps);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (IB.list_disjoint_or_eq q);
valid_memtaint mem q ts;
assert (IB.create_memtaint (_ih mem) ps ts ==
IB.write_taint 0 (_ih mem) ts b (IB.create_memtaint (_ih mem) q ts));
write_taint_lemma 0 (_ih mem) ts b (IB.create_memtaint (_ih mem) q ts);
opaque_assert (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def (forall p. List.memP p q ==> IB.disjoint_or_eq_b8 p b)
let valid_layout_data_buffer (t:base_typ) (b:buffer t) (layout:vale_heap_layout_inner) (hid:heaplet_id) (write:bool) =
exists (n:nat).{:pattern (Seq.index layout.vl_buffers n)} n < Seq.length layout.vl_buffers /\ (
let bi = Seq.index layout.vl_buffers n in
t == bi.bi_typ /\
b == bi.bi_buffer /\
(write ==> bi.bi_mutable == Mutable) /\
hid == bi.bi_heaplet)
[@"opaque_to_smt"]
let valid_layout_buffer_id t b layout h_id write =
match h_id with
| None -> True
| Some hid ->
layout.vl_inner.vl_heaplets_initialized /\
valid_layout_data_buffer t b layout.vl_inner hid write
let inv_heaplet_ids (hs:vale_heaplets) =
forall (i:heaplet_id).{:pattern Map16.sel hs i} (Map16.sel hs i).heapletId == Some i
let inv_heaplet (owns:Set.set int) (h hi:vale_heap) =
h.ih.IB.ptrs == hi.ih.IB.ptrs /\
Map.domain h.mh == Map.domain hi.mh /\
(forall (i:int).{:pattern Set.mem i owns \/ Set.mem i (Map.domain h.mh) \/ Map.sel h.mh i \/ Map.sel hi.mh i}
Set.mem i owns ==>
Set.mem i (Map.domain h.mh) /\
Map.sel h.mh i == Map.sel hi.mh i /\
True
) /\
True
// heaplet state matches heap state
let inv_buffer_info (bi:buffer_info) (owners:heaplet_id -> Set.set int) (h:vale_heap) (hs:vale_heaplets) (mt:memTaint_t) (modloc:loc) =
let t = bi.bi_typ in
let hid = bi.bi_heaplet in
let hi = Map16.get hs hid in
let b = bi.bi_buffer in
let owns = owners hid in
(bi.bi_mutable == Mutable ==> loc_includes modloc (loc_buffer b)) /\
buffer_readable h b /\
buffer_as_seq hi b == buffer_as_seq h b /\
(valid_taint_buf b hi mt bi.bi_taint <==> valid_taint_buf b h mt bi.bi_taint) /\
(forall (i:int).{:pattern Set.mem i owns}
buffer_addr b h <= i /\ i < buffer_addr b h + DV.length (get_downview b.bsrc) ==> Set.mem i owns) /\
True
let inv_heaplets (layout:vale_heap_layout_inner) (h:vale_heap) (hs:vale_heaplets) (mt:memTaint_t) =
let bs = layout.vl_buffers in
modifies layout.vl_mod_loc layout.vl_old_heap h /\ // modifies for entire heap
(forall (i:heaplet_id) (a:int).{:pattern Set.mem a (layout.vl_heaplet_sets i)}
layout.vl_heaplet_map a == Some i <==> Set.mem a (layout.vl_heaplet_sets i)
) /\
(forall (i:heaplet_id).{:pattern (Map16.sel hs i)}
inv_heaplet (layout.vl_heaplet_sets i) h (Map16.sel hs i)) /\
(forall (i:nat).{:pattern (Seq.index bs i)} i < Seq.length bs ==>
inv_buffer_info (Seq.index bs i) layout.vl_heaplet_sets h hs mt layout.vl_mod_loc) /\
(forall (i1 i2:nat).{:pattern (Seq.index bs i1); (Seq.index bs i2)}
i1 < Seq.length bs /\ i2 < Seq.length bs ==> buffer_info_disjoint (Seq.index bs i1) (Seq.index bs i2)) /\
True
let is_initial_heap layout h =
h == layout.vl_inner.vl_old_heap /\
not layout.vl_inner.vl_heaplets_initialized
let mem_inv h =
h.vf_heap.heapletId == None /\
inv_heaplet_ids h.vf_heaplets /\
(if h.vf_layout.vl_inner.vl_heaplets_initialized
then
inv_heaplets h.vf_layout.vl_inner h.vf_heap
h.vf_heaplets h.vf_layout.vl_taint
else
h.vf_heaplets == empty_vale_heaplets h.vf_layout.vl_inner.vl_old_heap
) | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": 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": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val layout_old_heap (layout:vale_heap_layout_inner) : vale_heap | [] | Vale.X64.Memory.layout_old_heap | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | layout: Vale.Arch.HeapImpl.vale_heap_layout_inner -> Vale.Arch.HeapImpl.vale_heap | {
"end_col": 47,
"end_line": 754,
"start_col": 29,
"start_line": 754
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tuint32 = UInt32.t | let tuint32 = | false | null | false | UInt32.t | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"FStar.UInt32.t"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tuint32 : Prims.eqtype | [] | Vale.X64.Memory.tuint32 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.eqtype | {
"end_col": 22,
"end_line": 33,
"start_col": 14,
"start_line": 33
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tuint16 = UInt16.t | let tuint16 = | false | null | false | UInt16.t | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"FStar.UInt16.t"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tuint16 : Prims.eqtype | [] | Vale.X64.Memory.tuint16 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.eqtype | {
"end_col": 22,
"end_line": 32,
"start_col": 14,
"start_line": 32
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let uint8_view = Vale.Interop.Views.up_view8 | let uint8_view = | false | null | false | Vale.Interop.Views.up_view8 | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"Vale.Interop.Views.up_view8"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
() | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint8_view : LowStar.BufferView.Up.view FStar.UInt8.t FStar.UInt8.t | [] | Vale.X64.Memory.uint8_view | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | LowStar.BufferView.Up.view FStar.UInt8.t FStar.UInt8.t | {
"end_col": 44,
"end_line": 58,
"start_col": 17,
"start_line": 58
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tuint64 = UInt64.t | let tuint64 = | false | null | false | UInt64.t | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"FStar.UInt64.t"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tuint64 : Prims.eqtype | [] | Vale.X64.Memory.tuint64 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.eqtype | {
"end_col": 22,
"end_line": 34,
"start_col": 14,
"start_line": 34
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Vale.Lib.BufferViewHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": false,
"full_module": "LowStar.ModifiesPat",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "Vale.Interop",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Base",
"short_module": "IB"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let uint128_view = Vale.Interop.Views.up_view128 | let uint128_view = | false | null | false | Vale.Interop.Views.up_view128 | {
"checked_file": "Vale.X64.Memory.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Lib.BufferViewHelpers.fst.checked",
"Vale.Interop.Views.fsti.checked",
"Vale.Interop.Types.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ModifiesPat.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Heap.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Memory.fst"
} | [
"total"
] | [
"Vale.Interop.Views.up_view128"
] | [] | module Vale.X64.Memory
include Vale.Interop.Types
friend Vale.Arch.Heap
open Vale.Def.Opaque_s
open Vale.Arch.HeapImpl
open Vale.Arch.Heap
open Vale.Interop.Base
module IB = Vale.Interop.Base
module I = Vale.Interop
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MB = LowStar.Monotonic.Buffer
module M = LowStar.Modifies
open LowStar.ModifiesPat
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
open Vale.Lib.BufferViewHelpers
module H = FStar.Heap
module S = Vale.X64.Machine_Semantics_s
#reset-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1"
let b8 = IB.b8
unfold let (.[]) = Map.sel
unfold let (.[]<-) = Map.upd
let get_heaplet_id h =
h.heapletId
let tuint8 = UInt8.t
let tuint16 = UInt16.t
let tuint32 = UInt32.t
let tuint64 = UInt64.t
let v_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : base_typ_as_type t =
match t with
| TUInt8 -> UInt8.uint_to_t v
| TUInt16 -> UInt16.uint_to_t v
| TUInt32 -> UInt32.uint_to_t v
| TUInt64 -> UInt64.uint_to_t v
| TUInt128 -> v
let v_to_typ (t:base_typ) (v:base_typ_as_type t) : base_typ_as_vale_type t =
match t with
| TUInt8 -> UInt8.v v
| TUInt16 -> UInt16.v v
| TUInt32 -> UInt32.v v
| TUInt64 -> UInt64.v v
| TUInt128 -> v
let lemma_v_to_of_typ (t:base_typ) (v:base_typ_as_vale_type t) : Lemma
(ensures v_to_typ t (v_of_typ t v) == v)
[SMTPat (v_to_typ t (v_of_typ t v))]
=
()
let uint8_view = Vale.Interop.Views.up_view8
let uint16_view = Vale.Interop.Views.up_view16
let uint32_view = Vale.Interop.Views.up_view32 | false | true | Vale.X64.Memory.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint128_view : LowStar.BufferView.Up.view FStar.UInt8.t Vale.Def.Types_s.quad32 | [] | Vale.X64.Memory.uint128_view | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | LowStar.BufferView.Up.view FStar.UInt8.t Vale.Def.Types_s.quad32 | {
"end_col": 48,
"end_line": 62,
"start_col": 19,
"start_line": 62
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.