file_name
stringlengths 5
52
| name
stringlengths 4
95
| original_source_type
stringlengths 0
23k
| source_type
stringlengths 9
23k
| source_definition
stringlengths 9
57.9k
| source
dict | source_range
dict | file_context
stringlengths 0
721k
| dependencies
dict | opens_and_abbrevs
listlengths 2
94
| vconfig
dict | interleaved
bool 1
class | verbose_type
stringlengths 1
7.42k
| effect
stringclasses 118
values | effect_flags
sequencelengths 0
2
| mutual_with
sequencelengths 0
11
| ideal_premises
sequencelengths 0
236
| proof_features
sequencelengths 0
1
| is_simple_lemma
bool 2
classes | is_div
bool 2
classes | is_proof
bool 2
classes | is_simply_typed
bool 2
classes | is_type
bool 2
classes | partial_definition
stringlengths 5
3.99k
| completed_definiton
stringlengths 1
1.63M
| isa_cross_project_example
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.invert_function' | val invert_function' (enum_ty val_ty teq f: T.term) : T.Tac T.term | val invert_function' (enum_ty val_ty teq f: T.term) : T.Tac T.term | let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function" | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 32,
"end_line": 131,
"start_col": 0,
"start_line": 118
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
enum_ty: FStar.Tactics.NamedView.term ->
val_ty: FStar.Tactics.NamedView.term ->
teq: FStar.Tactics.NamedView.term ->
f: FStar.Tactics.NamedView.term
-> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Tactics.NamedView.binder",
"FStar.Pervasives.Native.option",
"FStar.Tactics.NamedView.match_returns_ascription",
"Prims.list",
"FStar.Tactics.NamedView.branch",
"FStar.Stubs.Reflection.V2.Builtins.term_eq",
"FStar.Tactics.NamedView.pack",
"FStar.Tactics.NamedView.Tv_Var",
"FStar.Tactics.V2.SyntaxCoercions.binder_to_namedv",
"FStar.Tactics.NamedView.named_term_view",
"FStar.Tactics.NamedView.Tv_Abs",
"MiniParse.Spec.TEnum.invert_branches_with_cascade",
"FStar.Pervasives.Native.None",
"FStar.Tactics.NamedView.simple_binder",
"FStar.Tactics.V2.Derived.fresh_binder",
"Prims.bool",
"FStar.Tactics.V2.Derived.fail",
"FStar.Tactics.NamedView.inspect"
] | [] | false | true | false | false | false | let invert_function' (enum_ty val_ty teq f: T.term) : T.Tac T.term =
| match T.inspect f with
| T.Tv_Abs b body ->
(match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match")
| _ -> T.fail "Not a function" | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16_pred | val synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0 | val synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0 | let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 16,
"end_line": 155,
"start_col": 0,
"start_line": 148
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b: Prims.nat ->
t: Type ->
f1: (_: MiniParse.Spec.Int.bounded_u16 b -> Prims.GTot t) ->
f2: (_: t -> Prims.GTot (MiniParse.Spec.Int.bounded_u16 b)) ->
x: MiniParse.Spec.Int.bounded_u16 b
-> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.nat",
"MiniParse.Spec.Int.bounded_u16",
"Prims.eq2"
] | [] | false | false | false | false | true | let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0 =
| f2 (f1 x) == x | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.synth_inverse_forall_tenum_solve' | val synth_inverse_forall_tenum_solve': Prims.unit -> T.Tac unit | val synth_inverse_forall_tenum_solve': Prims.unit -> T.Tac unit | let synth_inverse_forall_tenum_solve' () : T.Tac unit =
T.norm [delta; zeta; iota; primops];
let x = tforall_intro () in
T.destruct (T.pack (T.Tv_Var (T.binding_to_namedv x)));
to_all_goals (fun () ->
let y = T.intro () in
T.rewrite y;
T.norm [delta; zeta; iota; primops];
T.trivial ();
T.qed ()
) | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 186,
"start_col": 0,
"start_line": 176
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt
let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x
let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0
= forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2)
val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1))
let synth_inverse_forall_bounded_u16_intro b t f1 f2 u
= Classical.forall_intro (Classical.move_requires (forall_bounded_u16_elim b (synth_inverse_forall_bounded_u16_pred b t f1 f2))) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | FStar.Tactics.Effect.Tac | [] | [] | [
"Prims.unit",
"MiniParse.Tac.Base.to_all_goals",
"FStar.Tactics.V2.Derived.qed",
"FStar.Tactics.V2.Derived.trivial",
"FStar.Stubs.Tactics.V2.Builtins.norm",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta",
"FStar.Pervasives.zeta",
"FStar.Pervasives.iota",
"FStar.Pervasives.primops",
"Prims.Nil",
"FStar.Stubs.Tactics.V2.Builtins.rewrite",
"FStar.Stubs.Reflection.V2.Data.binding",
"FStar.Stubs.Tactics.V2.Builtins.intro",
"FStar.Tactics.V2.Derived.destruct",
"FStar.Tactics.NamedView.pack",
"FStar.Tactics.NamedView.Tv_Var",
"FStar.Tactics.V2.SyntaxCoercions.binding_to_namedv",
"FStar.Tactics.NamedView.binding",
"MiniParse.Tac.Base.tforall_intro"
] | [] | false | true | false | false | false | let synth_inverse_forall_tenum_solve' () : T.Tac unit =
| T.norm [delta; zeta; iota; primops];
let x = tforall_intro () in
T.destruct (T.pack (T.Tv_Var (T.binding_to_namedv x)));
to_all_goals (fun () ->
let y = T.intro () in
T.rewrite y;
T.norm [delta; zeta; iota; primops];
T.trivial ();
T.qed ()) | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16_solve' | val synth_inverse_forall_bounded_u16_solve' (b t f1 f2: T.term) : T.Tac unit | val synth_inverse_forall_bounded_u16_solve' (b t f1 f2: T.term) : T.Tac unit | let synth_inverse_forall_bounded_u16_solve'
(b: T.term)
(t: T.term)
(f1: T.term)
(f2: T.term)
: T.Tac unit =
T.apply (T.mk_app (`(synth_inverse_forall_bounded_u16_intro)) [
b, T.Q_Explicit;
t, T.Q_Explicit;
f1, T.Q_Explicit;
f2, T.Q_Explicit;
]);
let _ = T.divide 1 (fun () ->
T.norm [delta; zeta; iota; primops];
T.trivial ();
tsuccess "synth_inverse_forall_bounded_u16_solve, main goal"
) (fun () ->
tconclude ()
)
in
tsuccess "synth_inverse_forall_bounded_u16_solve" | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 224,
"start_col": 0,
"start_line": 204
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt
let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x
let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0
= forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2)
val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1))
let synth_inverse_forall_bounded_u16_intro b t f1 f2 u
= Classical.forall_intro (Classical.move_requires (forall_bounded_u16_elim b (synth_inverse_forall_bounded_u16_pred b t f1 f2)))
let synth_inverse_forall_tenum_solve' () : T.Tac unit =
T.norm [delta; zeta; iota; primops];
let x = tforall_intro () in
T.destruct (T.pack (T.Tv_Var (T.binding_to_namedv x)));
to_all_goals (fun () ->
let y = T.intro () in
T.rewrite y;
T.norm [delta; zeta; iota; primops];
T.trivial ();
T.qed ()
)
let synth_inverse_forall_tenum_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(g, _)] ->
let (hd', _) = app_head_tail g in
if hd' `T.is_fvar` (`%synth_inverse)
then match T.trytac synth_inverse_forall_tenum_solve' with
| Some _ -> ()
| _ -> (if T.debugging () then
T.dump "synth_inverse_forall_tenum_solve FAILED here:";
tfail "synth_inverse_forall_tenum_solve failed")
else tfail "not a synth_inverse goal"
| _ -> tfail "not enough arguments to squash"
else tfail "not a squash" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b: FStar.Tactics.NamedView.term ->
t: FStar.Tactics.NamedView.term ->
f1: FStar.Tactics.NamedView.term ->
f2: FStar.Tactics.NamedView.term
-> FStar.Tactics.Effect.Tac Prims.unit | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"MiniParse.Tac.Base.tsuccess",
"Prims.unit",
"FStar.Pervasives.Native.tuple2",
"FStar.Tactics.V2.Derived.divide",
"FStar.Tactics.V2.Derived.trivial",
"FStar.Stubs.Tactics.V2.Builtins.norm",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta",
"FStar.Pervasives.zeta",
"FStar.Pervasives.iota",
"FStar.Pervasives.primops",
"Prims.Nil",
"MiniParse.Tac.Base.tconclude",
"FStar.Tactics.V2.Derived.apply",
"FStar.Reflection.V2.Derived.mk_app",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Stubs.Reflection.V2.Data.Q_Explicit"
] | [] | false | true | false | false | false | let synth_inverse_forall_bounded_u16_solve' (b t f1 f2: T.term) : T.Tac unit =
| T.apply (T.mk_app (`(synth_inverse_forall_bounded_u16_intro))
[b, T.Q_Explicit; t, T.Q_Explicit; f1, T.Q_Explicit; f2, T.Q_Explicit]);
let _ =
T.divide 1
(fun () ->
T.norm [delta; zeta; iota; primops];
T.trivial ();
tsuccess "synth_inverse_forall_bounded_u16_solve, main goal")
(fun () -> tconclude ())
in
tsuccess "synth_inverse_forall_bounded_u16_solve" | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.gen_enum_specs | val gen_enum_specs (enum: T.term) : T.Tac (T.term * T.term) | val gen_enum_specs (enum: T.term) : T.Tac (T.term * T.term) | let gen_enum_specs (enum: T.term) : T.Tac (T.term * T.term) =
let bound = tenum_bound' enum in
let f = gen_synth_bounded' enum in
let val_t = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
let val_eq = T.mk_app (`bounded_u16_eq) [bound, T.Q_Explicit] in
let g = invert_function' enum val_t val_eq f in
let pbound = T.mk_app (`parse_bounded_u16) [bound, T.Q_Explicit] in
let sbound = T.mk_app (`serialize_bounded_u16) [bound, T.Q_Explicit] in
let p' =
T.mk_app (`parse_synth) [
val_t, T.Q_Implicit;
enum, T.Q_Implicit;
pbound, T.Q_Explicit;
g, T.Q_Explicit;
f, T.Q_Explicit;
]
in
let s' =
T.mk_app (`serialize_synth) [
val_t, T.Q_Implicit;
enum, T.Q_Implicit;
pbound, T.Q_Implicit;
sbound, T.Q_Explicit;
g, T.Q_Explicit;
f, T.Q_Explicit;
(`()), T.Q_Explicit;
]
in
(p', s') | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 10,
"end_line": 277,
"start_col": 0,
"start_line": 249
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt
let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x
let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0
= forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2)
val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1))
let synth_inverse_forall_bounded_u16_intro b t f1 f2 u
= Classical.forall_intro (Classical.move_requires (forall_bounded_u16_elim b (synth_inverse_forall_bounded_u16_pred b t f1 f2)))
let synth_inverse_forall_tenum_solve' () : T.Tac unit =
T.norm [delta; zeta; iota; primops];
let x = tforall_intro () in
T.destruct (T.pack (T.Tv_Var (T.binding_to_namedv x)));
to_all_goals (fun () ->
let y = T.intro () in
T.rewrite y;
T.norm [delta; zeta; iota; primops];
T.trivial ();
T.qed ()
)
let synth_inverse_forall_tenum_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(g, _)] ->
let (hd', _) = app_head_tail g in
if hd' `T.is_fvar` (`%synth_inverse)
then match T.trytac synth_inverse_forall_tenum_solve' with
| Some _ -> ()
| _ -> (if T.debugging () then
T.dump "synth_inverse_forall_tenum_solve FAILED here:";
tfail "synth_inverse_forall_tenum_solve failed")
else tfail "not a synth_inverse goal"
| _ -> tfail "not enough arguments to squash"
else tfail "not a squash"
let synth_inverse_forall_bounded_u16_solve'
(b: T.term)
(t: T.term)
(f1: T.term)
(f2: T.term)
: T.Tac unit =
T.apply (T.mk_app (`(synth_inverse_forall_bounded_u16_intro)) [
b, T.Q_Explicit;
t, T.Q_Explicit;
f1, T.Q_Explicit;
f2, T.Q_Explicit;
]);
let _ = T.divide 1 (fun () ->
T.norm [delta; zeta; iota; primops];
T.trivial ();
tsuccess "synth_inverse_forall_bounded_u16_solve, main goal"
) (fun () ->
tconclude ()
)
in
tsuccess "synth_inverse_forall_bounded_u16_solve"
let synth_inverse_forall_bounded_u16_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(tl, _)] ->
let (hd', tl') = app_head_tail tl in
if hd' `T.is_fvar` (`%synth_inverse)
then begin match tl' with
| [ (t, _); (bt, _); (f2, _); (f1, _)] ->
let (bt_hd, bt_tl) = app_head_tail bt in
if bt_hd `T.is_fvar` (`%bounded_u16)
then begin match bt_tl with
| [(b, _)] ->
synth_inverse_forall_bounded_u16_solve' b t f1 f2
| _ -> tfail "not enough arguments to bounded_u16"
end else
let s = T.term_to_string bt in
tfail ("value type " ^ s ^ " is not bounded_u16")
| _ -> tfail "not enough arguments to synth_injective"
end else tfail "Goal is not synth_injective"
| _ -> tfail "Not enough arguments to squash"
else tfail "Goal is not squash" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | enum: FStar.Tactics.NamedView.term
-> FStar.Tactics.Effect.Tac (FStar.Tactics.NamedView.term * FStar.Tactics.NamedView.term) | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.Types.term",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.Cons",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Stubs.Reflection.V2.Data.Q_Implicit",
"FStar.Stubs.Reflection.V2.Data.Q_Explicit",
"Prims.Nil",
"FStar.Pervasives.Native.tuple2",
"MiniParse.Spec.TEnum.invert_function'",
"MiniParse.Spec.TEnum.gen_synth_bounded'",
"MiniParse.Spec.TEnum.tenum_bound'"
] | [] | false | true | false | false | false | let gen_enum_specs (enum: T.term) : T.Tac (T.term * T.term) =
| let bound = tenum_bound' enum in
let f = gen_synth_bounded' enum in
let val_t = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
let val_eq = T.mk_app (`bounded_u16_eq) [bound, T.Q_Explicit] in
let g = invert_function' enum val_t val_eq f in
let pbound = T.mk_app (`parse_bounded_u16) [bound, T.Q_Explicit] in
let sbound = T.mk_app (`serialize_bounded_u16) [bound, T.Q_Explicit] in
let p' =
T.mk_app (`parse_synth)
[
val_t, T.Q_Implicit;
enum, T.Q_Implicit;
pbound, T.Q_Explicit;
g, T.Q_Explicit;
f, T.Q_Explicit
]
in
let s' =
T.mk_app (`serialize_synth)
[
val_t, T.Q_Implicit;
enum, T.Q_Implicit;
pbound, T.Q_Implicit;
sbound, T.Q_Explicit;
g, T.Q_Explicit;
f, T.Q_Explicit;
(`()), T.Q_Explicit
]
in
(p', s') | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.gen_enum_parser' | val gen_enum_parser' (enum: T.term) : T.Tac T.term | val gen_enum_parser' (enum: T.term) : T.Tac T.term | let gen_enum_parser' (enum: T.term) : T.Tac T.term =
let (p', _) = gen_enum_specs enum in p' | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 41,
"end_line": 281,
"start_col": 0,
"start_line": 280
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt
let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x
let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0
= forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2)
val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1))
let synth_inverse_forall_bounded_u16_intro b t f1 f2 u
= Classical.forall_intro (Classical.move_requires (forall_bounded_u16_elim b (synth_inverse_forall_bounded_u16_pred b t f1 f2)))
let synth_inverse_forall_tenum_solve' () : T.Tac unit =
T.norm [delta; zeta; iota; primops];
let x = tforall_intro () in
T.destruct (T.pack (T.Tv_Var (T.binding_to_namedv x)));
to_all_goals (fun () ->
let y = T.intro () in
T.rewrite y;
T.norm [delta; zeta; iota; primops];
T.trivial ();
T.qed ()
)
let synth_inverse_forall_tenum_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(g, _)] ->
let (hd', _) = app_head_tail g in
if hd' `T.is_fvar` (`%synth_inverse)
then match T.trytac synth_inverse_forall_tenum_solve' with
| Some _ -> ()
| _ -> (if T.debugging () then
T.dump "synth_inverse_forall_tenum_solve FAILED here:";
tfail "synth_inverse_forall_tenum_solve failed")
else tfail "not a synth_inverse goal"
| _ -> tfail "not enough arguments to squash"
else tfail "not a squash"
let synth_inverse_forall_bounded_u16_solve'
(b: T.term)
(t: T.term)
(f1: T.term)
(f2: T.term)
: T.Tac unit =
T.apply (T.mk_app (`(synth_inverse_forall_bounded_u16_intro)) [
b, T.Q_Explicit;
t, T.Q_Explicit;
f1, T.Q_Explicit;
f2, T.Q_Explicit;
]);
let _ = T.divide 1 (fun () ->
T.norm [delta; zeta; iota; primops];
T.trivial ();
tsuccess "synth_inverse_forall_bounded_u16_solve, main goal"
) (fun () ->
tconclude ()
)
in
tsuccess "synth_inverse_forall_bounded_u16_solve"
let synth_inverse_forall_bounded_u16_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(tl, _)] ->
let (hd', tl') = app_head_tail tl in
if hd' `T.is_fvar` (`%synth_inverse)
then begin match tl' with
| [ (t, _); (bt, _); (f2, _); (f1, _)] ->
let (bt_hd, bt_tl) = app_head_tail bt in
if bt_hd `T.is_fvar` (`%bounded_u16)
then begin match bt_tl with
| [(b, _)] ->
synth_inverse_forall_bounded_u16_solve' b t f1 f2
| _ -> tfail "not enough arguments to bounded_u16"
end else
let s = T.term_to_string bt in
tfail ("value type " ^ s ^ " is not bounded_u16")
| _ -> tfail "not enough arguments to synth_injective"
end else tfail "Goal is not synth_injective"
| _ -> tfail "Not enough arguments to squash"
else tfail "Goal is not squash"
let gen_enum_specs (enum: T.term) : T.Tac (T.term * T.term) =
let bound = tenum_bound' enum in
let f = gen_synth_bounded' enum in
let val_t = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
let val_eq = T.mk_app (`bounded_u16_eq) [bound, T.Q_Explicit] in
let g = invert_function' enum val_t val_eq f in
let pbound = T.mk_app (`parse_bounded_u16) [bound, T.Q_Explicit] in
let sbound = T.mk_app (`serialize_bounded_u16) [bound, T.Q_Explicit] in
let p' =
T.mk_app (`parse_synth) [
val_t, T.Q_Implicit;
enum, T.Q_Implicit;
pbound, T.Q_Explicit;
g, T.Q_Explicit;
f, T.Q_Explicit;
]
in
let s' =
T.mk_app (`serialize_synth) [
val_t, T.Q_Implicit;
enum, T.Q_Implicit;
pbound, T.Q_Implicit;
sbound, T.Q_Explicit;
g, T.Q_Explicit;
f, T.Q_Explicit;
(`()), T.Q_Explicit;
]
in
(p', s') | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | enum: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Pervasives.Native.tuple2",
"MiniParse.Spec.TEnum.gen_enum_specs"
] | [] | false | true | false | false | false | let gen_enum_parser' (enum: T.term) : T.Tac T.term =
| let p', _ = gen_enum_specs enum in
p' | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.synth_inverse_forall_tenum_solve | val synth_inverse_forall_tenum_solve: Prims.unit -> T.Tac unit | val synth_inverse_forall_tenum_solve: Prims.unit -> T.Tac unit | let synth_inverse_forall_tenum_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(g, _)] ->
let (hd', _) = app_head_tail g in
if hd' `T.is_fvar` (`%synth_inverse)
then match T.trytac synth_inverse_forall_tenum_solve' with
| Some _ -> ()
| _ -> (if T.debugging () then
T.dump "synth_inverse_forall_tenum_solve FAILED here:";
tfail "synth_inverse_forall_tenum_solve failed")
else tfail "not a synth_inverse goal"
| _ -> tfail "not enough arguments to squash"
else tfail "not a squash" | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 27,
"end_line": 202,
"start_col": 0,
"start_line": 188
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt
let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x
let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0
= forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2)
val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1))
let synth_inverse_forall_bounded_u16_intro b t f1 f2 u
= Classical.forall_intro (Classical.move_requires (forall_bounded_u16_elim b (synth_inverse_forall_bounded_u16_pred b t f1 f2)))
let synth_inverse_forall_tenum_solve' () : T.Tac unit =
T.norm [delta; zeta; iota; primops];
let x = tforall_intro () in
T.destruct (T.pack (T.Tv_Var (T.binding_to_namedv x)));
to_all_goals (fun () ->
let y = T.intro () in
T.rewrite y;
T.norm [delta; zeta; iota; primops];
T.trivial ();
T.qed ()
) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | FStar.Tactics.Effect.Tac | [] | [] | [
"Prims.unit",
"FStar.Tactics.NamedView.term",
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.argv",
"Prims.op_BarBar",
"FStar.Reflection.V2.Derived.is_fvar",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Pervasives.Native.option",
"MiniParse.Tac.Base.tfail",
"FStar.Stubs.Tactics.V2.Builtins.dump",
"Prims.bool",
"FStar.Stubs.Tactics.V2.Builtins.debugging",
"FStar.Tactics.V2.Derived.trytac",
"MiniParse.Spec.TEnum.synth_inverse_forall_tenum_solve'",
"FStar.Pervasives.Native.tuple2",
"MiniParse.Tac.Base.app_head_tail",
"FStar.Tactics.V2.Derived.cur_goal",
"FStar.Stubs.Reflection.Types.typ"
] | [] | false | true | false | false | false | let synth_inverse_forall_tenum_solve () : T.Tac unit =
| let hd, tl = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then
match tl with
| [g, _] ->
let hd', _ = app_head_tail g in
if hd' `T.is_fvar` (`%synth_inverse)
then
match T.trytac synth_inverse_forall_tenum_solve' with
| Some _ -> ()
| _ ->
(if T.debugging () then T.dump "synth_inverse_forall_tenum_solve FAILED here:";
tfail "synth_inverse_forall_tenum_solve failed")
else tfail "not a synth_inverse goal"
| _ -> tfail "not enough arguments to squash"
else tfail "not a squash" | false |
References.fst | References.swap_textbook | val swap_textbook (#a: Type0) (r1 r2: ref a) (v1 v2: erased a)
: SteelT unit
((pts_to r1 full_perm v1) `star` (pts_to r2 full_perm v2))
(fun _ -> (pts_to r1 full_perm v2) `star` (pts_to r2 full_perm v1)) | val swap_textbook (#a: Type0) (r1 r2: ref a) (v1 v2: erased a)
: SteelT unit
((pts_to r1 full_perm v1) `star` (pts_to r2 full_perm v2))
(fun _ -> (pts_to r1 full_perm v2) `star` (pts_to r2 full_perm v1)) | let swap_textbook (#a:Type0) (r1 r2:ref a) (v1 v2:erased a) : SteelT unit
(pts_to r1 full_perm v1 `star` pts_to r2 full_perm v2)
(fun _ -> pts_to r1 full_perm v2 `star` pts_to r2 full_perm v1)
= let x1 = read_pt r1 in
let x2 = read_pt r2 in
write_pt r1 x2;
write_pt r2 x1;
// The extra trailing unit is a needed to trigger smt rewriting of x1 into v1 and x2 into v2
// It might be solved once we have smt_rewrites in subcomp
() | {
"file_name": "share/steel/tutorial/References.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 6,
"end_line": 25,
"start_col": 0,
"start_line": 16
} | module References
open FStar.Ghost
open Steel.FractionalPermission
open Steel.Effect.Atomic
open Steel.Effect
open Steel.Reference
/// Some examples using Steel references with fractional permissions
#push-options "--fuel 0 --ifuel 0 --ide_id_info_off"
(** Swap examples **) | {
"checked_file": "/",
"dependencies": [
"Steel.Reference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "References.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r1: Steel.Reference.ref a ->
r2: Steel.Reference.ref a ->
v1: FStar.Ghost.erased a ->
v2: FStar.Ghost.erased a
-> Steel.Effect.SteelT Prims.unit | Steel.Effect.SteelT | [] | [] | [
"Steel.Reference.ref",
"FStar.Ghost.erased",
"Prims.unit",
"Steel.Reference.write_pt",
"FStar.Ghost.hide",
"Steel.Reference.read_pt",
"Steel.FractionalPermission.full_perm",
"Steel.Effect.Common.star",
"Steel.Reference.pts_to",
"FStar.Ghost.reveal",
"Steel.Effect.Common.vprop"
] | [] | false | true | false | false | false | let swap_textbook (#a: Type0) (r1 r2: ref a) (v1 v2: erased a)
: SteelT unit
((pts_to r1 full_perm v1) `star` (pts_to r2 full_perm v2))
(fun _ -> (pts_to r1 full_perm v2) `star` (pts_to r2 full_perm v1)) =
| let x1 = read_pt r1 in
let x2 = read_pt r2 in
write_pt r1 x2;
write_pt r2 x1;
() | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.gen_enum_parser | val gen_enum_parser (pol: T.guard_policy) (enum: T.term) : T.Tac unit | val gen_enum_parser (pol: T.guard_policy) (enum: T.term) : T.Tac unit | let gen_enum_parser (pol: T.guard_policy) (enum: T.term) : T.Tac unit =
T.exact_guard (gen_enum_parser' enum);
according_to pol (fun () -> tconclude_with [
synth_inverse_forall_bounded_u16_solve;
synth_inverse_forall_tenum_solve;
]) | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 4,
"end_line": 288,
"start_col": 0,
"start_line": 283
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt
let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x
let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0
= forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2)
val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1))
let synth_inverse_forall_bounded_u16_intro b t f1 f2 u
= Classical.forall_intro (Classical.move_requires (forall_bounded_u16_elim b (synth_inverse_forall_bounded_u16_pred b t f1 f2)))
let synth_inverse_forall_tenum_solve' () : T.Tac unit =
T.norm [delta; zeta; iota; primops];
let x = tforall_intro () in
T.destruct (T.pack (T.Tv_Var (T.binding_to_namedv x)));
to_all_goals (fun () ->
let y = T.intro () in
T.rewrite y;
T.norm [delta; zeta; iota; primops];
T.trivial ();
T.qed ()
)
let synth_inverse_forall_tenum_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(g, _)] ->
let (hd', _) = app_head_tail g in
if hd' `T.is_fvar` (`%synth_inverse)
then match T.trytac synth_inverse_forall_tenum_solve' with
| Some _ -> ()
| _ -> (if T.debugging () then
T.dump "synth_inverse_forall_tenum_solve FAILED here:";
tfail "synth_inverse_forall_tenum_solve failed")
else tfail "not a synth_inverse goal"
| _ -> tfail "not enough arguments to squash"
else tfail "not a squash"
let synth_inverse_forall_bounded_u16_solve'
(b: T.term)
(t: T.term)
(f1: T.term)
(f2: T.term)
: T.Tac unit =
T.apply (T.mk_app (`(synth_inverse_forall_bounded_u16_intro)) [
b, T.Q_Explicit;
t, T.Q_Explicit;
f1, T.Q_Explicit;
f2, T.Q_Explicit;
]);
let _ = T.divide 1 (fun () ->
T.norm [delta; zeta; iota; primops];
T.trivial ();
tsuccess "synth_inverse_forall_bounded_u16_solve, main goal"
) (fun () ->
tconclude ()
)
in
tsuccess "synth_inverse_forall_bounded_u16_solve"
let synth_inverse_forall_bounded_u16_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(tl, _)] ->
let (hd', tl') = app_head_tail tl in
if hd' `T.is_fvar` (`%synth_inverse)
then begin match tl' with
| [ (t, _); (bt, _); (f2, _); (f1, _)] ->
let (bt_hd, bt_tl) = app_head_tail bt in
if bt_hd `T.is_fvar` (`%bounded_u16)
then begin match bt_tl with
| [(b, _)] ->
synth_inverse_forall_bounded_u16_solve' b t f1 f2
| _ -> tfail "not enough arguments to bounded_u16"
end else
let s = T.term_to_string bt in
tfail ("value type " ^ s ^ " is not bounded_u16")
| _ -> tfail "not enough arguments to synth_injective"
end else tfail "Goal is not synth_injective"
| _ -> tfail "Not enough arguments to squash"
else tfail "Goal is not squash"
let gen_enum_specs (enum: T.term) : T.Tac (T.term * T.term) =
let bound = tenum_bound' enum in
let f = gen_synth_bounded' enum in
let val_t = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
let val_eq = T.mk_app (`bounded_u16_eq) [bound, T.Q_Explicit] in
let g = invert_function' enum val_t val_eq f in
let pbound = T.mk_app (`parse_bounded_u16) [bound, T.Q_Explicit] in
let sbound = T.mk_app (`serialize_bounded_u16) [bound, T.Q_Explicit] in
let p' =
T.mk_app (`parse_synth) [
val_t, T.Q_Implicit;
enum, T.Q_Implicit;
pbound, T.Q_Explicit;
g, T.Q_Explicit;
f, T.Q_Explicit;
]
in
let s' =
T.mk_app (`serialize_synth) [
val_t, T.Q_Implicit;
enum, T.Q_Implicit;
pbound, T.Q_Implicit;
sbound, T.Q_Explicit;
g, T.Q_Explicit;
f, T.Q_Explicit;
(`()), T.Q_Explicit;
]
in
(p', s')
let gen_enum_parser' (enum: T.term) : T.Tac T.term =
let (p', _) = gen_enum_specs enum in p' | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | pol: FStar.Stubs.Tactics.Types.guard_policy -> enum: FStar.Tactics.NamedView.term
-> FStar.Tactics.Effect.Tac Prims.unit | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Stubs.Tactics.Types.guard_policy",
"FStar.Tactics.NamedView.term",
"MiniParse.Tac.Base.according_to",
"Prims.unit",
"MiniParse.Tac.Base.tconclude_with",
"Prims.Cons",
"MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16_solve",
"MiniParse.Spec.TEnum.synth_inverse_forall_tenum_solve",
"Prims.Nil",
"FStar.Tactics.V2.Derived.exact_guard",
"MiniParse.Spec.TEnum.gen_enum_parser'"
] | [] | false | true | false | false | false | let gen_enum_parser (pol: T.guard_policy) (enum: T.term) : T.Tac unit =
| T.exact_guard (gen_enum_parser' enum);
according_to pol
(fun () ->
tconclude_with [synth_inverse_forall_bounded_u16_solve; synth_inverse_forall_tenum_solve]) | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16_solve | val synth_inverse_forall_bounded_u16_solve: Prims.unit -> T.Tac unit | val synth_inverse_forall_bounded_u16_solve: Prims.unit -> T.Tac unit | let synth_inverse_forall_bounded_u16_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(tl, _)] ->
let (hd', tl') = app_head_tail tl in
if hd' `T.is_fvar` (`%synth_inverse)
then begin match tl' with
| [ (t, _); (bt, _); (f2, _); (f1, _)] ->
let (bt_hd, bt_tl) = app_head_tail bt in
if bt_hd `T.is_fvar` (`%bounded_u16)
then begin match bt_tl with
| [(b, _)] ->
synth_inverse_forall_bounded_u16_solve' b t f1 f2
| _ -> tfail "not enough arguments to bounded_u16"
end else
let s = T.term_to_string bt in
tfail ("value type " ^ s ^ " is not bounded_u16")
| _ -> tfail "not enough arguments to synth_injective"
end else tfail "Goal is not synth_injective"
| _ -> tfail "Not enough arguments to squash"
else tfail "Goal is not squash" | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 33,
"end_line": 247,
"start_col": 0,
"start_line": 226
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt
let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x
let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0
= forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2)
val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1))
let synth_inverse_forall_bounded_u16_intro b t f1 f2 u
= Classical.forall_intro (Classical.move_requires (forall_bounded_u16_elim b (synth_inverse_forall_bounded_u16_pred b t f1 f2)))
let synth_inverse_forall_tenum_solve' () : T.Tac unit =
T.norm [delta; zeta; iota; primops];
let x = tforall_intro () in
T.destruct (T.pack (T.Tv_Var (T.binding_to_namedv x)));
to_all_goals (fun () ->
let y = T.intro () in
T.rewrite y;
T.norm [delta; zeta; iota; primops];
T.trivial ();
T.qed ()
)
let synth_inverse_forall_tenum_solve () : T.Tac unit =
let (hd, tl) = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then match tl with
| [(g, _)] ->
let (hd', _) = app_head_tail g in
if hd' `T.is_fvar` (`%synth_inverse)
then match T.trytac synth_inverse_forall_tenum_solve' with
| Some _ -> ()
| _ -> (if T.debugging () then
T.dump "synth_inverse_forall_tenum_solve FAILED here:";
tfail "synth_inverse_forall_tenum_solve failed")
else tfail "not a synth_inverse goal"
| _ -> tfail "not enough arguments to squash"
else tfail "not a squash"
let synth_inverse_forall_bounded_u16_solve'
(b: T.term)
(t: T.term)
(f1: T.term)
(f2: T.term)
: T.Tac unit =
T.apply (T.mk_app (`(synth_inverse_forall_bounded_u16_intro)) [
b, T.Q_Explicit;
t, T.Q_Explicit;
f1, T.Q_Explicit;
f2, T.Q_Explicit;
]);
let _ = T.divide 1 (fun () ->
T.norm [delta; zeta; iota; primops];
T.trivial ();
tsuccess "synth_inverse_forall_bounded_u16_solve, main goal"
) (fun () ->
tconclude ()
)
in
tsuccess "synth_inverse_forall_bounded_u16_solve" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | FStar.Tactics.Effect.Tac | [] | [] | [
"Prims.unit",
"FStar.Tactics.NamedView.term",
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.argv",
"Prims.op_BarBar",
"FStar.Reflection.V2.Derived.is_fvar",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16_solve'",
"MiniParse.Tac.Base.tfail",
"Prims.bool",
"Prims.op_Hat",
"Prims.string",
"FStar.Stubs.Tactics.V2.Builtins.term_to_string",
"FStar.Pervasives.Native.tuple2",
"MiniParse.Tac.Base.app_head_tail",
"FStar.Tactics.V2.Derived.cur_goal",
"FStar.Stubs.Reflection.Types.typ"
] | [] | false | true | false | false | false | let synth_inverse_forall_bounded_u16_solve () : T.Tac unit =
| let hd, tl = app_head_tail (T.cur_goal ()) in
if hd `T.is_fvar` (`%squash) || hd `T.is_fvar` (`%auto_squash)
then
match tl with
| [tl, _] ->
let hd', tl' = app_head_tail tl in
if hd' `T.is_fvar` (`%synth_inverse)
then
match tl' with
| [t, _ ; bt, _ ; f2, _ ; f1, _] ->
let bt_hd, bt_tl = app_head_tail bt in
if bt_hd `T.is_fvar` (`%bounded_u16)
then
match bt_tl with
| [b, _] -> synth_inverse_forall_bounded_u16_solve' b t f1 f2
| _ -> tfail "not enough arguments to bounded_u16"
else
let s = T.term_to_string bt in
tfail ("value type " ^ s ^ " is not bounded_u16")
| _ -> tfail "not enough arguments to synth_injective"
else tfail "Goal is not synth_injective"
| _ -> tfail "Not enough arguments to squash"
else tfail "Goal is not squash" | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.mk_tenum_branches | val mk_tenum_branches (ty vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name)
: T.Tac (list T.branch) | val mk_tenum_branches (ty vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name)
: T.Tac (list T.branch) | let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 7,
"end_line": 44,
"start_col": 0,
"start_line": 24
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
ty: FStar.Tactics.NamedView.term ->
vty: FStar.Tactics.NamedView.term ->
v: Prims.nat ->
accu: Prims.list FStar.Tactics.NamedView.branch ->
l: Prims.list FStar.Stubs.Reflection.Types.name
-> FStar.Tactics.Effect.Tac (Prims.list FStar.Tactics.NamedView.branch) | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"Prims.nat",
"Prims.list",
"FStar.Tactics.NamedView.branch",
"FStar.Stubs.Reflection.Types.name",
"FStar.List.Tot.Base.append",
"Prims.Cons",
"Prims.Nil",
"FStar.Pervasives.Native.tuple2",
"FStar.Tactics.NamedView.pattern",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Tactics.NamedView.Pat_Var",
"FStar.Tactics.NamedView.Mkpattern__Pat_Var__payload",
"FStar.Sealed.seal",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Tactics.NamedView.namedv",
"FStar.Tactics.V2.Derived.fresh_namedv",
"MiniParse.Spec.TEnum.mk_tenum_branches",
"FStar.Tactics.NamedView.Pat_Cons",
"FStar.Tactics.NamedView.Mkpattern__Pat_Cons__payload",
"FStar.Stubs.Reflection.V2.Builtins.pack_fv",
"FStar.Pervasives.Native.None",
"FStar.Stubs.Reflection.V2.Data.universes",
"Prims.bool",
"FStar.Tactics.NamedView.pack",
"FStar.Tactics.NamedView.Tv_AscribedT",
"FStar.Stubs.Reflection.Types.term",
"FStar.Reflection.V2.Derived.mk_app",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Stubs.Reflection.V2.Data.Q_Explicit",
"MiniParse.Tac.Base.pack_nat",
"FStar.Stubs.Reflection.Types.env",
"FStar.Tactics.V2.Derived.cur_env",
"Prims.int",
"Prims.op_Addition"
] | [
"recursion"
] | false | true | false | false | false | let rec mk_tenum_branches (ty vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name)
: T.Tac (list T.branch) =
| match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat = T.Pat_Cons ({ head = T.pack_fv n; univs = None; subpats = [] }) in
let br:T.branch = (pat, v) in
let accu' = br :: accu in
match q with
| [] ->
let nv:T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var ({ v = nv; sort = Sealed.seal ty }) in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.get_inductive_constructors | val get_inductive_constructors (t: T.term) : T.Tac (list T.name) | val get_inductive_constructors (t: T.term) : T.Tac (list T.name) | let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable" | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 66,
"start_col": 0,
"start_line": 51
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term
-> FStar.Tactics.Effect.Tac (Prims.list FStar.Stubs.Reflection.Types.name) | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Stubs.Reflection.Types.fv",
"FStar.Pervasives.Native.uu___is_None",
"FStar.Stubs.Reflection.Types.sigelt",
"FStar.Tactics.V2.Derived.fail",
"Prims.list",
"FStar.Stubs.Reflection.Types.name",
"Prims.bool",
"FStar.Tactics.NamedView.univ_name",
"FStar.Tactics.NamedView.binders",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.Reflection.V2.Data.ctor",
"FStar.Tactics.Util.map",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.fst",
"FStar.Tactics.NamedView.named_sigelt_view",
"FStar.Tactics.NamedView.sigelt_view",
"FStar.Tactics.NamedView.inspect_sigelt",
"FStar.Pervasives.Native.__proj__Some__item__v",
"FStar.Pervasives.Native.option",
"FStar.Stubs.Reflection.V2.Builtins.lookup_typ",
"FStar.Stubs.Reflection.Types.env",
"FStar.Tactics.V2.Derived.cur_env",
"FStar.Stubs.Reflection.V2.Builtins.inspect_fv",
"FStar.Tactics.NamedView.named_term_view",
"FStar.Tactics.NamedView.term_view",
"FStar.Tactics.NamedView.inspect"
] | [] | false | true | false | false | false | let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
| let v:T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s:option T.sigelt = T.lookup_typ env u in
if None? s
then T.fail "No definition found"
else
let v:T.sigelt_view = T.inspect_sigelt (Some?.v s) in
(match v with
| T.Sg_Inductive { ctors = ctors } -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type")
| _ -> T.fail "Not a free variable" | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.invert_branches_with_cascade | val invert_branches_with_cascade (enum_ty val_eq x: T.term) (accu: option T.term) (l: list T.branch)
: T.Tac T.term | val invert_branches_with_cascade (enum_ty val_eq x: T.term) (accu: option T.term) (l: list T.branch)
: T.Tac T.term | let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 7,
"end_line": 116,
"start_col": 0,
"start_line": 94
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
enum_ty: FStar.Tactics.NamedView.term ->
val_eq: FStar.Tactics.NamedView.term ->
x: FStar.Tactics.NamedView.term ->
accu: FStar.Pervasives.Native.option FStar.Tactics.NamedView.term ->
l: Prims.list FStar.Tactics.NamedView.branch
-> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Pervasives.Native.option",
"Prims.list",
"FStar.Tactics.NamedView.branch",
"MiniParse.Tac.Base.tfail",
"FStar.Tactics.NamedView.pattern",
"MiniParse.Spec.TEnum.invert_branches_with_cascade",
"FStar.Pervasives.Native.Some",
"MiniParse.Tac.Base.mk_if",
"FStar.Stubs.Reflection.Types.term",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.Cons",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Stubs.Reflection.V2.Data.Q_Explicit",
"Prims.Nil",
"MiniParse.Spec.TEnum.term_of_pat"
] | [
"recursion"
] | false | true | false | false | false | let rec invert_branches_with_cascade
(enum_ty val_eq x: T.term)
(accu: option T.term)
(l: list T.branch)
: T.Tac T.term =
| match l with
| [] ->
(match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t)
| (p, t) :: q ->
match term_of_pat p with
| Some v ->
let accu' =
match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [(x, T.Q_Explicit); (t, T.Q_Explicit)] in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q | false |
LowParse.Bytes32.fst | LowParse.Bytes32.reveal_empty' | val reveal_empty':squash (reveal empty_bytes == Seq.empty) | val reveal_empty':squash (reveal empty_bytes == Seq.empty) | let reveal_empty' : squash (reveal empty_bytes == Seq.empty) =
assert (Seq.equal (reveal empty_bytes) Seq.empty) | {
"file_name": "src/lowparse/LowParse.Bytes32.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 51,
"end_line": 60,
"start_col": 0,
"start_line": 59
} | module LowParse.Bytes32
include FStar.Bytes
module U32 = FStar.UInt32
(* TODO: move to FStar.Bytes *)
inline_for_extraction
let b32slice
(b: bytes)
(s: U32.t)
(e: U32.t)
: Pure bytes
(requires (U32.v s <= U32.v e /\ U32.v e <= length b))
(ensures (fun res -> reveal res == Seq.slice (reveal b) (U32.v s) (U32.v e)))
= slice b s e
inline_for_extraction
let b32append
(b1: bytes)
(b2: bytes)
: Pure bytes
(requires (length b1 + length b2 < 4294967296))
(ensures (fun y -> reveal y == Seq.append (reveal b1) (reveal b2)))
= append b1 b2
let b32_index_reveal
(b: bytes)
(i: nat { i < length b })
: Lemma
(Seq.index (reveal b) i == index b i)
= ()
let b32_reveal_create
(len: U32.t)
(v: byte)
: Lemma
(reveal (create len v) == Seq.create (U32.v len) v)
[SMTPat (reveal (create len v))]
= let b = create len v in
let lhs = reveal b in
let rhs = Seq.create (U32.v len) v in
let pty = (i: nat { i < Seq.length lhs }) in
let post
(i: pty)
: GTot Type0
= Seq.index lhs (i <: nat) == Seq.index rhs (i <: nat)
in
let f
(i: pty)
: Lemma
(post i)
= assert (get b (U32.uint_to_t i) == v)
in
Classical.forall_intro #pty #post f;
Seq.lemma_eq_intro lhs rhs;
Seq.lemma_eq_elim lhs rhs | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Bytes32.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.squash (FStar.Bytes.reveal FStar.Bytes.empty_bytes == FStar.Seq.Base.empty) | Prims.Tot | [
"total"
] | [] | [
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Bytes.byte",
"FStar.Bytes.reveal",
"FStar.Bytes.empty_bytes",
"FStar.Seq.Base.empty"
] | [] | false | false | true | true | false | let reveal_empty':squash (reveal empty_bytes == Seq.empty) =
| assert (Seq.equal (reveal empty_bytes) Seq.empty) | false |
LowParse.Bytes32.fst | LowParse.Bytes32.b32slice | val b32slice (b: bytes) (s e: U32.t)
: Pure bytes
(requires (U32.v s <= U32.v e /\ U32.v e <= length b))
(ensures (fun res -> reveal res == Seq.slice (reveal b) (U32.v s) (U32.v e))) | val b32slice (b: bytes) (s e: U32.t)
: Pure bytes
(requires (U32.v s <= U32.v e /\ U32.v e <= length b))
(ensures (fun res -> reveal res == Seq.slice (reveal b) (U32.v s) (U32.v e))) | let b32slice
(b: bytes)
(s: U32.t)
(e: U32.t)
: Pure bytes
(requires (U32.v s <= U32.v e /\ U32.v e <= length b))
(ensures (fun res -> reveal res == Seq.slice (reveal b) (U32.v s) (U32.v e)))
= slice b s e | {
"file_name": "src/lowparse/LowParse.Bytes32.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 13,
"end_line": 16,
"start_col": 0,
"start_line": 9
} | module LowParse.Bytes32
include FStar.Bytes
module U32 = FStar.UInt32
(* TODO: move to FStar.Bytes *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Bytes32.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: FStar.Bytes.bytes -> s: FStar.UInt32.t -> e: FStar.UInt32.t -> Prims.Pure FStar.Bytes.bytes | Prims.Pure | [] | [] | [
"FStar.Bytes.bytes",
"FStar.UInt32.t",
"FStar.Bytes.slice",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.UInt32.v",
"FStar.Bytes.length",
"Prims.eq2",
"FStar.Seq.Base.seq",
"FStar.Bytes.byte",
"FStar.Bytes.reveal",
"FStar.Seq.Base.slice"
] | [] | false | false | false | false | false | let b32slice (b: bytes) (s e: U32.t)
: Pure bytes
(requires (U32.v s <= U32.v e /\ U32.v e <= length b))
(ensures (fun res -> reveal res == Seq.slice (reveal b) (U32.v s) (U32.v e))) =
| slice b s e | false |
LowParse.Bytes32.fst | LowParse.Bytes32.b32append | val b32append (b1 b2: bytes)
: Pure bytes
(requires (length b1 + length b2 < 4294967296))
(ensures (fun y -> reveal y == Seq.append (reveal b1) (reveal b2))) | val b32append (b1 b2: bytes)
: Pure bytes
(requires (length b1 + length b2 < 4294967296))
(ensures (fun y -> reveal y == Seq.append (reveal b1) (reveal b2))) | let b32append
(b1: bytes)
(b2: bytes)
: Pure bytes
(requires (length b1 + length b2 < 4294967296))
(ensures (fun y -> reveal y == Seq.append (reveal b1) (reveal b2)))
= append b1 b2 | {
"file_name": "src/lowparse/LowParse.Bytes32.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 14,
"end_line": 25,
"start_col": 0,
"start_line": 19
} | module LowParse.Bytes32
include FStar.Bytes
module U32 = FStar.UInt32
(* TODO: move to FStar.Bytes *)
inline_for_extraction
let b32slice
(b: bytes)
(s: U32.t)
(e: U32.t)
: Pure bytes
(requires (U32.v s <= U32.v e /\ U32.v e <= length b))
(ensures (fun res -> reveal res == Seq.slice (reveal b) (U32.v s) (U32.v e)))
= slice b s e | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Bytes32.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b1: FStar.Bytes.bytes -> b2: FStar.Bytes.bytes -> Prims.Pure FStar.Bytes.bytes | Prims.Pure | [] | [] | [
"FStar.Bytes.bytes",
"FStar.Bytes.append",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_Addition",
"FStar.Bytes.length",
"Prims.eq2",
"FStar.Seq.Base.seq",
"FStar.Bytes.byte",
"FStar.Bytes.reveal",
"FStar.Seq.Base.append"
] | [] | false | false | false | false | false | let b32append (b1 b2: bytes)
: Pure bytes
(requires (length b1 + length b2 < 4294967296))
(ensures (fun y -> reveal y == Seq.append (reveal b1) (reveal b2))) =
| append b1 b2 | false |
LowParse.Bytes32.fst | LowParse.Bytes32.b32_hide | val b32_hide (s: Seq.seq FStar.UInt8.t {Seq.length s < pow2 32})
: Tot (res: bytes{res == hide s}) (decreases (Seq.length s)) | val b32_hide (s: Seq.seq FStar.UInt8.t {Seq.length s < pow2 32})
: Tot (res: bytes{res == hide s}) (decreases (Seq.length s)) | let rec b32_hide (s: Seq.seq FStar.UInt8.t { Seq.length s < pow2 32 }) : Tot (res: bytes { res == hide s })
(decreases (Seq.length s))
=
let res : bytes =
if Seq.length s = 0
then empty_bytes
else append (create 1ul (Seq.index s 0)) (b32_hide (Seq.slice s 1 (Seq.length s)))
in
b32_equal res (hide s);
res | {
"file_name": "src/lowparse/LowParse.Bytes32.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 5,
"end_line": 82,
"start_col": 0,
"start_line": 73
} | module LowParse.Bytes32
include FStar.Bytes
module U32 = FStar.UInt32
(* TODO: move to FStar.Bytes *)
inline_for_extraction
let b32slice
(b: bytes)
(s: U32.t)
(e: U32.t)
: Pure bytes
(requires (U32.v s <= U32.v e /\ U32.v e <= length b))
(ensures (fun res -> reveal res == Seq.slice (reveal b) (U32.v s) (U32.v e)))
= slice b s e
inline_for_extraction
let b32append
(b1: bytes)
(b2: bytes)
: Pure bytes
(requires (length b1 + length b2 < 4294967296))
(ensures (fun y -> reveal y == Seq.append (reveal b1) (reveal b2)))
= append b1 b2
let b32_index_reveal
(b: bytes)
(i: nat { i < length b })
: Lemma
(Seq.index (reveal b) i == index b i)
= ()
let b32_reveal_create
(len: U32.t)
(v: byte)
: Lemma
(reveal (create len v) == Seq.create (U32.v len) v)
[SMTPat (reveal (create len v))]
= let b = create len v in
let lhs = reveal b in
let rhs = Seq.create (U32.v len) v in
let pty = (i: nat { i < Seq.length lhs }) in
let post
(i: pty)
: GTot Type0
= Seq.index lhs (i <: nat) == Seq.index rhs (i <: nat)
in
let f
(i: pty)
: Lemma
(post i)
= assert (get b (U32.uint_to_t i) == v)
in
Classical.forall_intro #pty #post f;
Seq.lemma_eq_intro lhs rhs;
Seq.lemma_eq_elim lhs rhs
let reveal_empty' : squash (reveal empty_bytes == Seq.empty) =
assert (Seq.equal (reveal empty_bytes) Seq.empty)
let reveal_empty () : Lemma
(reveal empty_bytes == Seq.empty)
= ()
let b32_equal
(b1 b2: bytes)
: Lemma
(requires (reveal b1 `Seq.equal` reveal b2))
(ensures (b1 == b2))
= () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Bytes32.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: FStar.Seq.Base.seq FStar.UInt8.t {FStar.Seq.Base.length s < Prims.pow2 32}
-> Prims.Tot (res: FStar.Bytes.bytes{res == FStar.Bytes.hide s}) | Prims.Tot | [
"total",
""
] | [] | [
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Prims.pow2",
"Prims.unit",
"LowParse.Bytes32.b32_equal",
"FStar.Bytes.hide",
"FStar.Bytes.bytes",
"Prims.op_Equality",
"Prims.int",
"FStar.Bytes.empty_bytes",
"Prims.bool",
"FStar.Bytes.append",
"FStar.Bytes.create",
"FStar.UInt32.__uint_to_t",
"FStar.Seq.Base.index",
"LowParse.Bytes32.b32_hide",
"FStar.Seq.Base.slice",
"Prims.eq2"
] | [
"recursion"
] | false | false | false | false | false | let rec b32_hide (s: Seq.seq FStar.UInt8.t {Seq.length s < pow2 32})
: Tot (res: bytes{res == hide s}) (decreases (Seq.length s)) =
| let res:bytes =
if Seq.length s = 0
then empty_bytes
else append (create 1ul (Seq.index s 0)) (b32_hide (Seq.slice s 1 (Seq.length s)))
in
b32_equal res (hide s);
res | false |
LowParse.Bytes32.fst | LowParse.Bytes32.b32_reveal_create | val b32_reveal_create (len: U32.t) (v: byte)
: Lemma (reveal (create len v) == Seq.create (U32.v len) v) [SMTPat (reveal (create len v))] | val b32_reveal_create (len: U32.t) (v: byte)
: Lemma (reveal (create len v) == Seq.create (U32.v len) v) [SMTPat (reveal (create len v))] | let b32_reveal_create
(len: U32.t)
(v: byte)
: Lemma
(reveal (create len v) == Seq.create (U32.v len) v)
[SMTPat (reveal (create len v))]
= let b = create len v in
let lhs = reveal b in
let rhs = Seq.create (U32.v len) v in
let pty = (i: nat { i < Seq.length lhs }) in
let post
(i: pty)
: GTot Type0
= Seq.index lhs (i <: nat) == Seq.index rhs (i <: nat)
in
let f
(i: pty)
: Lemma
(post i)
= assert (get b (U32.uint_to_t i) == v)
in
Classical.forall_intro #pty #post f;
Seq.lemma_eq_intro lhs rhs;
Seq.lemma_eq_elim lhs rhs | {
"file_name": "src/lowparse/LowParse.Bytes32.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 27,
"end_line": 57,
"start_col": 0,
"start_line": 34
} | module LowParse.Bytes32
include FStar.Bytes
module U32 = FStar.UInt32
(* TODO: move to FStar.Bytes *)
inline_for_extraction
let b32slice
(b: bytes)
(s: U32.t)
(e: U32.t)
: Pure bytes
(requires (U32.v s <= U32.v e /\ U32.v e <= length b))
(ensures (fun res -> reveal res == Seq.slice (reveal b) (U32.v s) (U32.v e)))
= slice b s e
inline_for_extraction
let b32append
(b1: bytes)
(b2: bytes)
: Pure bytes
(requires (length b1 + length b2 < 4294967296))
(ensures (fun y -> reveal y == Seq.append (reveal b1) (reveal b2)))
= append b1 b2
let b32_index_reveal
(b: bytes)
(i: nat { i < length b })
: Lemma
(Seq.index (reveal b) i == index b i)
= () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Bytes32.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | len: FStar.UInt32.t -> v: FStar.Bytes.byte
-> FStar.Pervasives.Lemma
(ensures
FStar.Bytes.reveal (FStar.Bytes.create len v) ==
FStar.Seq.Base.create (FStar.UInt32.v len) v)
[SMTPat (FStar.Bytes.reveal (FStar.Bytes.create len v))] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.UInt32.t",
"FStar.Bytes.byte",
"FStar.Seq.Base.lemma_eq_elim",
"Prims.unit",
"FStar.Seq.Base.lemma_eq_intro",
"FStar.Classical.forall_intro",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Prims._assert",
"Prims.eq2",
"FStar.Bytes.get",
"FStar.UInt32.uint_to_t",
"FStar.Seq.Base.index",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"FStar.Seq.Base.create",
"FStar.UInt32.v",
"FStar.Bytes.reveal",
"FStar.Bytes.lbytes",
"Prims.l_Forall",
"FStar.UInt32.lt",
"FStar.Bytes.create",
"Prims.Cons",
"FStar.Pervasives.smt_pat"
] | [] | false | false | true | false | false | let b32_reveal_create (len: U32.t) (v: byte)
: Lemma (reveal (create len v) == Seq.create (U32.v len) v) [SMTPat (reveal (create len v))] =
| let b = create len v in
let lhs = reveal b in
let rhs = Seq.create (U32.v len) v in
let pty = (i: nat{i < Seq.length lhs}) in
let post (i: pty) : GTot Type0 = Seq.index lhs (i <: nat) == Seq.index rhs (i <: nat) in
let f (i: pty) : Lemma (post i) = assert (get b (U32.uint_to_t i) == v) in
Classical.forall_intro #pty #post f;
Seq.lemma_eq_intro lhs rhs;
Seq.lemma_eq_elim lhs rhs | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16_intro | val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1)) | val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1)) | let synth_inverse_forall_bounded_u16_intro b t f1 f2 u
= Classical.forall_intro (Classical.move_requires (forall_bounded_u16_elim b (synth_inverse_forall_bounded_u16_pred b t f1 f2))) | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 128,
"end_line": 174,
"start_col": 0,
"start_line": 173
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt
let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x
let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0
= forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2)
val synth_inverse_forall_bounded_u16_intro
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(u: squash (synth_inverse_forall_bounded_u16' b t f1 f2))
: Tot (squash (synth_inverse f2 f1)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b: Prims.nat ->
t: Type0 ->
f1: (_: MiniParse.Spec.Int.bounded_u16 b -> Prims.GTot t) ->
f2: (_: t -> Prims.GTot (MiniParse.Spec.Int.bounded_u16 b)) ->
u91: Prims.squash (MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16' b t f1 f2)
-> Prims.squash (MiniParse.Spec.Combinators.synth_inverse f2 f1) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"MiniParse.Spec.Int.bounded_u16",
"Prims.squash",
"MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16'",
"FStar.Classical.forall_intro",
"Prims.l_imp",
"MiniParse.Spec.Int.forall_bounded_u16",
"MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16_pred",
"FStar.Classical.move_requires",
"MiniParse.Spec.Int.forall_bounded_u16_elim",
"MiniParse.Spec.Combinators.synth_inverse"
] | [] | false | false | true | false | false | let synth_inverse_forall_bounded_u16_intro b t f1 f2 u =
| Classical.forall_intro (Classical.move_requires (forall_bounded_u16_elim b
(synth_inverse_forall_bounded_u16_pred b t f1 f2))) | false |
Steel.GhostMonotonicHigherReference.fst | Steel.GhostMonotonicHigherReference.witness | val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:ref a p)
(fact:stable_property p)
(v:erased a)
(_:squash (fact v))
: SteelAtomicUT (witnessed r fact) inames
(pts_to r q v)
(fun _ -> pts_to r q v) | val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:ref a p)
(fact:stable_property p)
(v:erased a)
(_:squash (fact v))
: SteelAtomicUT (witnessed r fact) inames
(pts_to r q v)
(fun _ -> pts_to r q v) | let witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a)
(r:ref a p)
(fact:stable_property p)
(v:erased a)
(_:squash (fact v))
: SteelAtomicUT (witnessed r fact) inames
(pts_to r q v)
(fun _ -> pts_to r q v)
= let h = witness_exists #_ #_ #(pts_to_body r q v) () in
let _ = elim_pure #_ #_ #_ #q r v h in
assert (forall h'. compatible pcm_history h h' ==> lift_fact fact h');
lift_fact_is_stable #a #p fact;
let w = witness_thunk #_ #_ #(pcm_history #a #p) r (lift_fact fact) h () () in
intro_pure_full r v h;
rewrite_slprop (pts_to _ q _) (pts_to r q v) (fun _ -> ());
return w | {
"file_name": "lib/steel/Steel.GhostMonotonicHigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 12,
"end_line": 147,
"start_col": 0,
"start_line": 128
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.GhostMonotonicHigherReference
open FStar.Ghost
open FStar.PCM
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.GhostPCMReference
open Steel.FractionalPermission
open Steel.Preorder
module Preorder = FStar.Preorder
module Q = Steel.Preorder
module M = Steel.Memory
module PR = Steel.GhostPCMReference
module A = Steel.Effect.Atomic
open FStar.Real
#set-options "--ide_id_info_off"
let ref a p = PR.ref (history a p) pcm_history
[@@__reduce__]
let pts_to_body #a #p (r:ref a p) (f:perm) (v:a) (h:history a p) =
PR.pts_to r h `star`
pure (history_val h v f)
let pts_to' (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v: a) =
h_exists (pts_to_body r f v)
let pts_to_sl r f v = hp_of (pts_to' r f v)
let intro_pure #opened #a #p #f
(r:ref a p)
(v:a)
(h:history a p { history_val h v f })
: SteelGhostT unit opened
(PR.pts_to r h)
(fun _ -> pts_to_body r f v h)
= A.intro_pure (history_val h v f)
let intro_pure_full #opened #a #p #f
(r:ref a p)
(v:a)
(h:history a p { history_val h v f })
: SteelGhostT unit opened
(PR.pts_to r h)
(fun _ -> pts_to r f v)
= intro_pure #_ #a #p #f r v h;
intro_exists h (pts_to_body r f v)
let alloc #_ (#a:Type) (p:Preorder.preorder a) (v:a)
= let h = Current [v] full_perm in
assert (compatible pcm_history h h);
let x : ref a p = alloc h in
intro_pure_full x v h;
x
let extract_pure #a #uses #p #f
(r:ref a p)
(v:a)
(h:(history a p))
: SteelGhostT (_:unit{history_val h v f})
uses
(pts_to_body r f v h)
(fun _ -> pts_to_body r f v h)
= elim_pure (history_val h v f);
A.intro_pure (history_val h v f)
let elim_pure #a #uses #p #f
(r:ref a p)
(v:a)
(h:(history a p))
: SteelGhostT (_:unit{history_val h v f})
uses
(pts_to_body r f v h)
(fun _ -> PR.pts_to r h)
= let _ = extract_pure r v h in
drop (pure (history_val h v f))
let write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)
(r:ref a p) (x:a)
: SteelGhost unit opened (pts_to r full_perm v)
(fun v -> pts_to r full_perm x)
(requires fun _ -> p v x /\ True)
(ensures fun _ _ _ -> True)
= let h_old_e = witness_exists #_ #_ #(pts_to_body r full_perm v) () in
let _ = elim_pure r v h_old_e in
let h_old = read r in
let h: history a p = extend_history' h_old x in
write r h_old_e h;
intro_pure_full r x h
let witnessed #a #p r fact =
PR.witnessed r (lift_fact fact)
let get_squash (#p:prop) (_:unit{p}) : squash p = ()
let witness_thunk (#inames: _) (#a:Type) (#pcm:FStar.PCM.pcm a)
(r:PR.ref a pcm)
(fact:M.stable_property pcm)
(v:erased a)
(sq:squash (fact_valid_compat #_ #pcm fact v))
(_:unit)
: SteelAtomicUT (PR.witnessed r fact) inames
(PR.pts_to r v)
(fun _ -> PR.pts_to r v)
= witness r fact v sq | {
"checked_file": "/",
"dependencies": [
"Steel.Preorder.fst.checked",
"Steel.Memory.fsti.checked",
"Steel.GhostPCMReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"prims.fst.checked",
"FStar.Real.fsti.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.GhostMonotonicHigherReference.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Real",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Effect.Atomic",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "Steel.GhostPCMReference",
"short_module": "PR"
},
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "Steel.Preorder",
"short_module": "Q"
},
{
"abbrev": false,
"full_module": "Steel.Preorder",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.GhostPCMReference",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "Preorder"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: Steel.GhostMonotonicHigherReference.ref a p ->
fact: Steel.GhostMonotonicHigherReference.stable_property p ->
v: FStar.Ghost.erased a ->
_: Prims.squash (fact (FStar.Ghost.reveal v))
-> Steel.Effect.Atomic.SteelAtomicUT (Steel.GhostMonotonicHigherReference.witnessed r fact) | Steel.Effect.Atomic.SteelAtomicUT | [] | [] | [
"Steel.Memory.inames",
"Steel.FractionalPermission.perm",
"FStar.Preorder.preorder",
"Steel.GhostMonotonicHigherReference.ref",
"Steel.GhostMonotonicHigherReference.stable_property",
"FStar.Ghost.erased",
"Prims.squash",
"FStar.Ghost.reveal",
"Steel.Effect.Atomic.return",
"Steel.GhostMonotonicHigherReference.witnessed",
"Steel.GhostMonotonicHigherReference.pts_to",
"Steel.Effect.Common.vprop",
"Prims.unit",
"Steel.Effect.Atomic.rewrite_slprop",
"Steel.Memory.mem",
"Steel.GhostMonotonicHigherReference.intro_pure_full",
"Steel.Preorder.history",
"Steel.GhostPCMReference.witnessed",
"Steel.Preorder.pcm_history",
"Steel.Preorder.lift_fact",
"Steel.GhostMonotonicHigherReference.witness_thunk",
"Steel.Preorder.lift_fact_is_stable",
"Prims._assert",
"Prims.l_Forall",
"Prims.l_imp",
"FStar.PCM.compatible",
"Steel.Preorder.history_val",
"FStar.Ghost.hide",
"Steel.GhostMonotonicHigherReference.elim_pure",
"Steel.Effect.Atomic.witness_exists",
"Steel.GhostMonotonicHigherReference.pts_to_body"
] | [] | false | true | false | false | false | let witness
(#inames: _)
(#a: Type)
(#q: perm)
(#p: Preorder.preorder a)
(r: ref a p)
(fact: stable_property p)
(v: erased a)
(_: squash (fact v))
: SteelAtomicUT (witnessed r fact) inames (pts_to r q v) (fun _ -> pts_to r q v) =
| let h = witness_exists #_ #_ #(pts_to_body r q v) () in
let _ = elim_pure #_ #_ #_ #q r v h in
assert (forall h'. compatible pcm_history h h' ==> lift_fact fact h');
lift_fact_is_stable #a #p fact;
let w = witness_thunk #_ #_ #(pcm_history #a #p) r (lift_fact fact) h () () in
intro_pure_full r v h;
rewrite_slprop (pts_to _ q _) (pts_to r q v) (fun _ -> ());
return w | false |
OPLSS.Plain.fst | OPLSS.Plain.reveal | val reveal (p:plain) : GTot AES.plain | val reveal (p:plain) : GTot AES.plain | let reveal (p:plain) : GTot AES.plain = p | {
"file_name": "examples/crypto/OPLSS.Plain.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 41,
"end_line": 22,
"start_col": 0,
"start_line": 22
} | (*
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 OPLSS.Plain
open OPLSS
open OPLSS.Ideal
type plain : eqtype = AES.plain | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.Ideal.fsti.checked",
"OPLSS.Flag.fsti.checked",
"OPLSS.AES.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "OPLSS.Plain.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS.Ideal",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: OPLSS.Plain.plain -> Prims.GTot OPLSS.AES.plain | Prims.GTot | [
"sometrivial"
] | [] | [
"OPLSS.Plain.plain",
"OPLSS.AES.plain"
] | [] | false | false | false | false | false | let reveal (p: plain) : GTot AES.plain =
| p | false |
OPLSS.Plain.fst | OPLSS.Plain.hide | val hide (b:AES.plain) : GTot plain | val hide (b:AES.plain) : GTot plain | let hide (b:AES.plain) : GTot plain = b | {
"file_name": "examples/crypto/OPLSS.Plain.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 24,
"start_col": 0,
"start_line": 24
} | (*
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 OPLSS.Plain
open OPLSS
open OPLSS.Ideal
type plain : eqtype = AES.plain
let reveal (p:plain) : GTot AES.plain = p | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.Ideal.fsti.checked",
"OPLSS.Flag.fsti.checked",
"OPLSS.AES.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "OPLSS.Plain.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS.Ideal",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: OPLSS.AES.plain -> Prims.GTot OPLSS.Plain.plain | Prims.GTot | [
"sometrivial"
] | [] | [
"OPLSS.AES.plain",
"OPLSS.Plain.plain"
] | [] | false | false | false | false | false | let hide (b: AES.plain) : GTot plain =
| b | false |
OPLSS.Plain.fst | OPLSS.Plain.repr | val repr (p:plain{not (Flag.reveal conf)})
: (b:AES.plain{b == reveal p}) | val repr (p:plain{not (Flag.reveal conf)})
: (b:AES.plain{b == reveal p}) | let repr (p:plain{not (Flag.reveal conf)})
: (b:AES.plain{b == reveal p})
= p | {
"file_name": "examples/crypto/OPLSS.Plain.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 5,
"end_line": 38,
"start_col": 0,
"start_line": 36
} | (*
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 OPLSS.Plain
open OPLSS
open OPLSS.Ideal
type plain : eqtype = AES.plain
let reveal (p:plain) : GTot AES.plain = p
let hide (b:AES.plain) : GTot plain = b
let reveal_hide (p:plain)
: Lemma (hide (reveal p) == p)
[SMTPat (reveal p)]
= ()
let hide_reveal (b:AES.plain)
: Lemma (reveal (hide b) == b)
[SMTPat (hide b)]
= () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.Ideal.fsti.checked",
"OPLSS.Flag.fsti.checked",
"OPLSS.AES.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "OPLSS.Plain.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS.Ideal",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: OPLSS.Plain.plain{Prims.op_Negation (OPLSS.Flag.reveal OPLSS.Ideal.conf)}
-> b: OPLSS.AES.plain{b == OPLSS.Plain.reveal p} | Prims.Tot | [
"total"
] | [] | [
"OPLSS.Plain.plain",
"Prims.b2t",
"Prims.op_Negation",
"OPLSS.Flag.reveal",
"OPLSS.Ideal.conf",
"OPLSS.AES.plain",
"Prims.eq2",
"OPLSS.Plain.reveal"
] | [] | false | false | false | false | false | let repr (p: plain{not (Flag.reveal conf)}) : (b: AES.plain{b == reveal p}) =
| p | false |
OPLSS.Plain.fst | OPLSS.Plain.coerce | val coerce (r:AES.plain{not (Flag.reveal auth)})
: (p:plain{p == hide r}) | val coerce (r:AES.plain{not (Flag.reveal auth)})
: (p:plain{p == hide r}) | let coerce (r:AES.plain{not (Flag.reveal auth)})
: (p:plain{p == hide r})
= r | {
"file_name": "examples/crypto/OPLSS.Plain.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 5,
"end_line": 42,
"start_col": 0,
"start_line": 40
} | (*
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 OPLSS.Plain
open OPLSS
open OPLSS.Ideal
type plain : eqtype = AES.plain
let reveal (p:plain) : GTot AES.plain = p
let hide (b:AES.plain) : GTot plain = b
let reveal_hide (p:plain)
: Lemma (hide (reveal p) == p)
[SMTPat (reveal p)]
= ()
let hide_reveal (b:AES.plain)
: Lemma (reveal (hide b) == b)
[SMTPat (hide b)]
= ()
let repr (p:plain{not (Flag.reveal conf)})
: (b:AES.plain{b == reveal p})
= p | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.Ideal.fsti.checked",
"OPLSS.Flag.fsti.checked",
"OPLSS.AES.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "OPLSS.Plain.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS.Ideal",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: OPLSS.AES.plain{Prims.op_Negation (OPLSS.Flag.reveal OPLSS.Ideal.auth)}
-> p: OPLSS.Plain.plain{p == OPLSS.Plain.hide r} | Prims.Tot | [
"total"
] | [] | [
"OPLSS.AES.plain",
"Prims.b2t",
"Prims.op_Negation",
"OPLSS.Flag.reveal",
"OPLSS.Ideal.auth",
"OPLSS.Plain.plain",
"Prims.eq2",
"OPLSS.Plain.hide"
] | [] | false | false | false | false | false | let coerce (r: AES.plain{not (Flag.reveal auth)}) : (p: plain{p == hide r}) =
| r | false |
OPLSS.Plain.fst | OPLSS.Plain.length | val length (p:plain)
: (n:nat{n = Seq.length (reveal p)}) | val length (p:plain)
: (n:nat{n = Seq.length (reveal p)}) | let length (p:plain)
: (n:nat{n = Seq.length (reveal p)})
= Seq.length p | {
"file_name": "examples/crypto/OPLSS.Plain.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 16,
"end_line": 46,
"start_col": 0,
"start_line": 44
} | (*
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 OPLSS.Plain
open OPLSS
open OPLSS.Ideal
type plain : eqtype = AES.plain
let reveal (p:plain) : GTot AES.plain = p
let hide (b:AES.plain) : GTot plain = b
let reveal_hide (p:plain)
: Lemma (hide (reveal p) == p)
[SMTPat (reveal p)]
= ()
let hide_reveal (b:AES.plain)
: Lemma (reveal (hide b) == b)
[SMTPat (hide b)]
= ()
let repr (p:plain{not (Flag.reveal conf)})
: (b:AES.plain{b == reveal p})
= p
let coerce (r:AES.plain{not (Flag.reveal auth)})
: (p:plain{p == hide r})
= r | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.Ideal.fsti.checked",
"OPLSS.Flag.fsti.checked",
"OPLSS.AES.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "OPLSS.Plain.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS.Ideal",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: OPLSS.Plain.plain -> n: Prims.nat{n = FStar.Seq.Base.length (OPLSS.Plain.reveal p)} | Prims.Tot | [
"total"
] | [] | [
"OPLSS.Plain.plain",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"Prims.nat",
"Prims.b2t",
"Prims.op_Equality",
"OPLSS.Plain.reveal"
] | [] | false | false | false | false | false | let length (p: plain) : (n: nat{n = Seq.length (reveal p)}) =
| Seq.length p | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.sprot | val sprot : Type | let sprot = p:prot { more p } | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 29,
"end_line": 28,
"start_col": 0,
"start_line": 28
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Prims.b2t",
"Steel.Channel.Protocol.more"
] | [] | false | false | false | true | true | let sprot =
| p: prot{more p} | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.trace_ref | val trace_ref : p: Steel.Channel.Simplex.prot -> Type0 | let trace_ref (p:prot) = mref (partial_trace_of p) extended_to | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 62,
"end_line": 38,
"start_col": 0,
"start_line": 38
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
} | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Steel.Channel.Simplex.prot -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.mref",
"Steel.Channel.Protocol.partial_trace_of",
"Steel.Channel.Protocol.extended_to"
] | [] | false | false | false | true | true | let trace_ref (p: prot) =
| mref (partial_trace_of p) extended_to | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.half | val half:perm | val half:perm | let half : perm = half_perm full_perm | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 37,
"end_line": 47,
"start_col": 0,
"start_line": 47
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
} | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Steel.FractionalPermission.perm | Prims.Tot | [
"total"
] | [] | [
"Steel.FractionalPermission.half_perm",
"Steel.FractionalPermission.full_perm"
] | [] | false | false | false | true | false | let half:perm =
| half_perm full_perm | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.chan_inv_step_p | val chan_inv_step_p (vrecv vsend: chan_val) : prop | val chan_inv_step_p (vrecv vsend: chan_val) : prop | let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 40,
"end_line": 53,
"start_col": 0,
"start_line": 51
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | vrecv: Steel.Channel.Simplex.chan_val -> vsend: Steel.Channel.Simplex.chan_val -> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.chan_val",
"Prims.l_and",
"Prims.eq2",
"Steel.Channel.Protocol.protocol",
"Prims.unit",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_prot",
"Steel.Channel.Simplex.step",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_msg",
"Prims.int",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_ctr",
"Prims.op_Addition",
"Prims.prop"
] | [] | false | false | false | true | true | let chan_inv_step_p (vrecv vsend: chan_val) : prop =
| (vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\ vsend.chan_ctr == vrecv.chan_ctr + 1) | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.mref | val mref : a: Type -> p: FStar.Preorder.preorder a -> Type0 | let mref a p = MRef.ref a p | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 27,
"end_line": 37,
"start_col": 0,
"start_line": 37
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
} | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> p: FStar.Preorder.preorder a -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Preorder.preorder",
"Steel.MonotonicHigherReference.ref"
] | [] | false | false | false | true | true | let mref a p =
| MRef.ref a p | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.chan_inv_step | val chan_inv_step (vrecv vsend: chan_val) : vprop | val chan_inv_step (vrecv vsend: chan_val) : vprop | let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 36,
"end_line": 56,
"start_col": 0,
"start_line": 55
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | vrecv: Steel.Channel.Simplex.chan_val -> vsend: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.chan_val",
"Steel.Effect.Common.pure",
"Steel.Channel.Simplex.chan_inv_step_p",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let chan_inv_step (vrecv vsend: chan_val) : vprop =
| pure (chan_inv_step_p vrecv vsend) | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.trace_until_prop | val trace_until_prop (#p: _) (r: trace_ref p) (vr: chan_val) (tr: partial_trace_of p) : vprop | val trace_until_prop (#p: _) (r: trace_ref p) (vr: chan_val) (tr: partial_trace_of p) : vprop | let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 50,
"end_line": 65,
"start_col": 0,
"start_line": 63
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: Steel.Channel.Simplex.trace_ref p ->
vr: Steel.Channel.Simplex.chan_val ->
tr: Steel.Channel.Protocol.partial_trace_of p
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.trace_ref",
"Steel.Channel.Simplex.chan_val",
"Steel.Channel.Protocol.partial_trace_of",
"Steel.Effect.Common.star",
"Steel.MonotonicHigherReference.pts_to",
"Steel.Channel.Protocol.extended_to",
"Steel.FractionalPermission.full_perm",
"FStar.Ghost.hide",
"Steel.Effect.Common.pure",
"Prims.eq2",
"Steel.Channel.Protocol.protocol",
"Prims.unit",
"Steel.Channel.Protocol.until",
"Steel.Channel.Simplex.step",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_prot",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_msg",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let trace_until_prop #p (r: trace_ref p) (vr: chan_val) (tr: partial_trace_of p) : vprop =
| (MRef.pts_to r full_perm tr) `star` (pure (until tr == step vr.chan_prot vr.chan_msg)) | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.trace_until | val trace_until : r: Steel.Channel.Simplex.trace_ref p -> vr: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 34,
"end_line": 68,
"start_col": 0,
"start_line": 67
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: Steel.Channel.Simplex.trace_ref p -> vr: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.trace_ref",
"Steel.Channel.Simplex.chan_val",
"Steel.Effect.Atomic.h_exists",
"Steel.Channel.Protocol.partial_trace_of",
"Steel.Channel.Simplex.trace_until_prop",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let trace_until #p (r: trace_ref p) (vr: chan_val) =
| h_exists (trace_until_prop r vr) | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.chan_inv_recv | val chan_inv_recv : c: Steel.Channel.Simplex.chan_t p -> vsend: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 32,
"end_line": 74,
"start_col": 0,
"start_line": 70
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Steel.Channel.Simplex.chan_t p -> vsend: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan_t",
"Steel.Channel.Simplex.chan_val",
"Steel.Effect.Atomic.h_exists",
"Steel.Effect.Common.star",
"Steel.HigherReference.pts_to",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__recv",
"Steel.Channel.Simplex.half",
"Steel.Channel.Simplex.trace_until",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__trace",
"Steel.Channel.Simplex.chan_inv_cond",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let chan_inv_recv #p (c: chan_t p) (vsend: chan_val) =
| h_exists (fun (vrecv: chan_val) ->
((pts_to c.recv half vrecv) `star` (trace_until c.trace vrecv))
`star`
(chan_inv_cond vsend vrecv)) | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.chan_inv | val chan_inv (#p: _) (c: chan_t p) : vprop | val chan_inv (#p: _) (c: chan_t p) : vprop | let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 58,
"end_line": 78,
"start_col": 0,
"start_line": 76
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Steel.Channel.Simplex.chan_t p -> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan_t",
"Steel.Effect.Atomic.h_exists",
"Steel.Channel.Simplex.chan_val",
"Steel.Effect.Common.star",
"Steel.HigherReference.pts_to",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__send",
"Steel.Channel.Simplex.half",
"Steel.Channel.Simplex.chan_inv_recv",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let chan_inv #p (c: chan_t p) : vprop =
| h_exists (fun (vsend: chan_val) -> (pts_to c.send half vsend) `star` (chan_inv_recv c vsend)) | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.in_state_prop | val in_state_prop (p: prot) (vsend: chan_val) : prop | val in_state_prop (p: prot) (vsend: chan_val) : prop | let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 42,
"end_line": 131,
"start_col": 0,
"start_line": 130
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
} | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Steel.Channel.Simplex.prot -> vsend: Steel.Channel.Simplex.chan_val -> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan_val",
"Prims.eq2",
"Steel.Channel.Protocol.protocol",
"Prims.unit",
"Steel.Channel.Simplex.step",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_prot",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_msg",
"Prims.prop"
] | [] | false | false | false | true | true | let in_state_prop (p: prot) (vsend: chan_val) : prop =
| p == step vsend.chan_prot vsend.chan_msg | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.init_chan_val | val init_chan_val : p: Steel.Channel.Simplex.prot -> Type | let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p} | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 67,
"end_line": 166,
"start_col": 0,
"start_line": 166
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Steel.Channel.Simplex.prot -> Type | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan_val",
"Prims.eq2",
"Steel.Channel.Protocol.prot",
"Prims.unit",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_prot",
"Steel.Channel.Simplex.msg",
"Prims.eqtype"
] | [] | false | false | false | true | true | let init_chan_val (p: prot) =
| v: chan_val{v.chan_prot == msg unit p} | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.in_state | val in_state : r: Steel.HigherReference.ref Steel.Channel.Simplex.chan_val -> p: Steel.Channel.Simplex.prot
-> Steel.Effect.Common.vprop | let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 55,
"end_line": 147,
"start_col": 0,
"start_line": 145
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: Steel.HigherReference.ref Steel.Channel.Simplex.chan_val -> p: Steel.Channel.Simplex.prot
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.HigherReference.ref",
"Steel.Channel.Simplex.chan_val",
"Steel.Channel.Simplex.prot",
"Steel.Effect.Atomic.h_exists",
"Steel.Effect.Common.star",
"Steel.HigherReference.pts_to",
"Steel.Channel.Simplex.half",
"Steel.Channel.Simplex.in_state_slprop",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let in_state (r: ref chan_val) (p: prot) =
| h_exists (fun (vsend: chan_val) -> (pts_to r half vsend) `star` (in_state_slprop p vsend)) | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.chan_val_p | val chan_val_p : p: Steel.Channel.Simplex.prot -> Type | let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 }) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 64,
"end_line": 159,
"start_col": 0,
"start_line": 159
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Steel.Channel.Simplex.prot -> Type | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan_val",
"Steel.Channel.Simplex.in_state_prop"
] | [] | false | false | false | true | true | let chan_val_p (p: prot) =
| (vs0: chan_val{in_state_prop p vs0}) | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.in_state_slprop | val in_state_slprop (p: prot) (vsend: chan_val) : vprop | val in_state_slprop (p: prot) (vsend: chan_val) : vprop | let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 84,
"end_line": 143,
"start_col": 0,
"start_line": 143
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
} | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Steel.Channel.Simplex.prot -> vsend: Steel.Channel.Simplex.chan_val -> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan_val",
"Steel.Effect.Common.pure",
"Steel.Channel.Simplex.in_state_prop",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let in_state_slprop (p: prot) (vsend: chan_val) : vprop =
| pure (in_state_prop p vsend) | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.receiver | val receiver (#p:prot) (c:chan p) (next_action:prot) : vprop | val receiver (#p:prot) (c:chan p) (next_action:prot) : vprop | let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 65,
"end_line": 150,
"start_col": 0,
"start_line": 150
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Steel.Channel.Simplex.chan p -> next_action: Steel.Channel.Simplex.prot
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan",
"Steel.Channel.Simplex.in_state",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__recv",
"Steel.Channel.Simplex.__proj__Mkchan__item__chan_chan",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let receiver #q (c: chan q) (p: prot) =
| in_state c.chan_chan.recv p | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.sender | val sender (#p:prot) (c:chan p) (next_action:prot) : vprop | val sender (#p:prot) (c:chan p) (next_action:prot) : vprop | let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 63,
"end_line": 149,
"start_col": 0,
"start_line": 149
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Steel.Channel.Simplex.chan p -> next_action: Steel.Channel.Simplex.prot
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan",
"Steel.Channel.Simplex.in_state",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__send",
"Steel.Channel.Simplex.__proj__Mkchan__item__chan_chan",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let sender #q (c: chan q) (p: prot) =
| in_state c.chan_chan.send p | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.step | val step : s: Steel.Channel.Simplex.sprot -> x: Steel.Channel.Protocol.msg_t s
-> Steel.Channel.Protocol.protocol Prims.unit | let step (s:sprot) (x:msg_t s) = step s x | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 41,
"end_line": 49,
"start_col": 0,
"start_line": 49
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: Steel.Channel.Simplex.sprot -> x: Steel.Channel.Protocol.msg_t s
-> Steel.Channel.Protocol.protocol Prims.unit | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.sprot",
"Steel.Channel.Protocol.msg_t",
"Steel.Channel.Protocol.step",
"Prims.unit",
"Steel.Channel.Protocol.protocol"
] | [] | false | false | false | false | false | let step (s: sprot) (x: msg_t s) =
| step s x | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.chan_t_sr | val chan_t_sr : p: Steel.Channel.Simplex.prot ->
send: Steel.HigherReference.ref Steel.Channel.Simplex.chan_val ->
recv: Steel.HigherReference.ref Steel.Channel.Simplex.chan_val
-> Type0 | let chan_t_sr (p:prot) (send recv:ref chan_val) = (c:chan_t p{c.send == send /\ c.recv == recv}) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 96,
"end_line": 183,
"start_col": 0,
"start_line": 183
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p}
let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p}
let intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)
: Steel unit (MRef.pts_to r full_perm tr)
(fun _ -> trace_until r v)
(requires fun _ -> until tr == step v.chan_prot v.chan_msg)
(ensures fun _ _ _ -> True)
= intro_pure (until tr == step v.chan_prot v.chan_msg);
intro_exists tr
(fun (tr:partial_trace_of q) ->
MRef.pts_to r full_perm tr `star`
pure (until tr == (step v.chan_prot v.chan_msg)));
() | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: Steel.Channel.Simplex.prot ->
send: Steel.HigherReference.ref Steel.Channel.Simplex.chan_val ->
recv: Steel.HigherReference.ref Steel.Channel.Simplex.chan_val
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.HigherReference.ref",
"Steel.Channel.Simplex.chan_val",
"Steel.Channel.Simplex.chan_t",
"Prims.l_and",
"Prims.eq2",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__send",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__recv"
] | [] | false | false | false | true | true | let chan_t_sr (p: prot) (send recv: ref chan_val) =
| (c: chan_t p {c.send == send /\ c.recv == recv}) | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.msg | val msg : t: _ -> p: Steel.Channel.Protocol.prot _ -> Steel.Channel.Protocol.prot _ | let msg t p = Msg Send unit (fun _ -> p) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 40,
"end_line": 165,
"start_col": 0,
"start_line": 165
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: _ -> p: Steel.Channel.Protocol.prot _ -> Steel.Channel.Protocol.prot _ | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Protocol.prot",
"Steel.Channel.Protocol.Msg",
"Steel.Channel.Protocol.Send",
"Prims.unit"
] | [] | false | false | false | true | false | let msg t p =
| Msg Send unit (fun _ -> p) | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.send_recv_in_sync | val send_recv_in_sync (r: ref chan_val) (p: prot{more p}) (#q: _) (c: chan_t q) (vs vr: chan_val)
: vprop | val send_recv_in_sync (r: ref chan_val) (p: prot{more p}) (#q: _) (c: chan_t q) (vs vr: chan_val)
: vprop | let send_recv_in_sync (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
pure (vs == vr) `star`
in_state r p) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 18,
"end_line": 249,
"start_col": 0,
"start_line": 244
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p}
let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p}
let intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)
: Steel unit (MRef.pts_to r full_perm tr)
(fun _ -> trace_until r v)
(requires fun _ -> until tr == step v.chan_prot v.chan_msg)
(ensures fun _ _ _ -> True)
= intro_pure (until tr == step v.chan_prot v.chan_msg);
intro_exists tr
(fun (tr:partial_trace_of q) ->
MRef.pts_to r full_perm tr `star`
pure (until tr == (step v.chan_prot v.chan_msg)));
()
let chan_t_sr (p:prot) (send recv:ref chan_val) = (c:chan_t p{c.send == send /\ c.recv == recv})
let intro_trace_until_init #p (c:chan_t p) (v:init_chan_val p)
: SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p))
(fun _ -> trace_until c.trace v)
= intro_pure (until (initial_trace p) == step v.chan_prot v.chan_msg);
//TODO: Not sure why I need this rewrite
rewrite_slprop (MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(fun _ -> ());
intro_exists (initial_trace p) (trace_until_prop c.trace v)
let mk_chan (#p:prot) (send recv:ref chan_val) (v:init_chan_val p)
: SteelT (chan_t_sr p send recv)
(pts_to send half v `star` pts_to recv half v)
(fun c -> chan_inv c)
= let tr: trace_ref p = MRef.alloc (extended_to #p) (initial_trace p) in
let c = Mkchan_t send recv tr in
rewrite_slprop
(MRef.pts_to tr full_perm (initial_trace p))
(MRef.pts_to c.trace full_perm (initial_trace p)) (fun _ -> ());
intro_trace_until_init c v;
rewrite_slprop
(pts_to send half v `star` pts_to recv half v)
(pts_to c.send half v `star` pts_to c.recv half v)
(fun _ -> ());
intro_chan_inv #p c v;
let c' : chan_t_sr p send recv = c in
rewrite_slprop (chan_inv c) (chan_inv c') (fun _ -> ());
return c'
let new_chan (p:prot) : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)
= let q = msg unit p in
let v : chan_val = { chan_prot = q; chan_msg = (); chan_ctr = 0 } in
let vp : init_chan_val p = v in
let send = H.alloc v in
let recv = H.alloc v in
H.share recv;
H.share send;
(* TODO: use smt_fallback *)
rewrite_slprop (pts_to send (half_perm full_perm) v `star`
pts_to send (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v)
(pts_to send half vp `star`
pts_to send half vp `star`
pts_to recv half vp `star`
pts_to recv half vp)
(fun _ -> ());
let c = mk_chan send recv vp in
intro_in_state send p vp;
intro_in_state recv p vp;
let l = Steel.SpinLock.new_lock (chan_inv c) in
let ch = { chan_chan = c; chan_lock = l } in
rewrite_slprop (in_state send p) (sender ch p) (fun _ -> ());
rewrite_slprop (in_state recv p) (receiver ch p) (fun _ -> ());
return ch | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: Steel.HigherReference.ref Steel.Channel.Simplex.chan_val ->
p: Steel.Channel.Simplex.prot{Steel.Channel.Protocol.more p} ->
c: Steel.Channel.Simplex.chan_t q ->
vs: Steel.Channel.Simplex.chan_val ->
vr: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.HigherReference.ref",
"Steel.Channel.Simplex.chan_val",
"Steel.Channel.Simplex.prot",
"Prims.b2t",
"Steel.Channel.Protocol.more",
"Steel.Channel.Simplex.chan_t",
"Steel.Effect.Common.star",
"Steel.HigherReference.pts_to",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__send",
"Steel.Channel.Simplex.half",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__recv",
"Steel.Channel.Simplex.trace_until",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__trace",
"Steel.Effect.Common.pure",
"Prims.eq2",
"Steel.Channel.Simplex.in_state",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let send_recv_in_sync
(r: ref chan_val)
(p: prot{more p})
#q
(c: chan_t q)
(vs: chan_val)
(vr: chan_val)
: vprop =
| (((((pts_to c.send half vs) `star` (pts_to c.recv half vr)) `star` (trace_until c.trace vr))
`star`
(pure (vs == vr)))
`star`
(in_state r p)) | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.sender_ahead | val sender_ahead (r: ref chan_val) (p: prot{more p}) (#q: _) (c: chan_t q) (vs vr: chan_val) : vprop | val sender_ahead (r: ref chan_val) (p: prot{more p}) (#q: _) (c: chan_t q) (vs vr: chan_val) : vprop | let sender_ahead (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs `star`
in_state r p) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 18,
"end_line": 257,
"start_col": 0,
"start_line": 252
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p}
let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p}
let intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)
: Steel unit (MRef.pts_to r full_perm tr)
(fun _ -> trace_until r v)
(requires fun _ -> until tr == step v.chan_prot v.chan_msg)
(ensures fun _ _ _ -> True)
= intro_pure (until tr == step v.chan_prot v.chan_msg);
intro_exists tr
(fun (tr:partial_trace_of q) ->
MRef.pts_to r full_perm tr `star`
pure (until tr == (step v.chan_prot v.chan_msg)));
()
let chan_t_sr (p:prot) (send recv:ref chan_val) = (c:chan_t p{c.send == send /\ c.recv == recv})
let intro_trace_until_init #p (c:chan_t p) (v:init_chan_val p)
: SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p))
(fun _ -> trace_until c.trace v)
= intro_pure (until (initial_trace p) == step v.chan_prot v.chan_msg);
//TODO: Not sure why I need this rewrite
rewrite_slprop (MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(fun _ -> ());
intro_exists (initial_trace p) (trace_until_prop c.trace v)
let mk_chan (#p:prot) (send recv:ref chan_val) (v:init_chan_val p)
: SteelT (chan_t_sr p send recv)
(pts_to send half v `star` pts_to recv half v)
(fun c -> chan_inv c)
= let tr: trace_ref p = MRef.alloc (extended_to #p) (initial_trace p) in
let c = Mkchan_t send recv tr in
rewrite_slprop
(MRef.pts_to tr full_perm (initial_trace p))
(MRef.pts_to c.trace full_perm (initial_trace p)) (fun _ -> ());
intro_trace_until_init c v;
rewrite_slprop
(pts_to send half v `star` pts_to recv half v)
(pts_to c.send half v `star` pts_to c.recv half v)
(fun _ -> ());
intro_chan_inv #p c v;
let c' : chan_t_sr p send recv = c in
rewrite_slprop (chan_inv c) (chan_inv c') (fun _ -> ());
return c'
let new_chan (p:prot) : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)
= let q = msg unit p in
let v : chan_val = { chan_prot = q; chan_msg = (); chan_ctr = 0 } in
let vp : init_chan_val p = v in
let send = H.alloc v in
let recv = H.alloc v in
H.share recv;
H.share send;
(* TODO: use smt_fallback *)
rewrite_slprop (pts_to send (half_perm full_perm) v `star`
pts_to send (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v)
(pts_to send half vp `star`
pts_to send half vp `star`
pts_to recv half vp `star`
pts_to recv half vp)
(fun _ -> ());
let c = mk_chan send recv vp in
intro_in_state send p vp;
intro_in_state recv p vp;
let l = Steel.SpinLock.new_lock (chan_inv c) in
let ch = { chan_chan = c; chan_lock = l } in
rewrite_slprop (in_state send p) (sender ch p) (fun _ -> ());
rewrite_slprop (in_state recv p) (receiver ch p) (fun _ -> ());
return ch
[@@__reduce__]
let send_recv_in_sync (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
pure (vs == vr) `star`
in_state r p) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: Steel.HigherReference.ref Steel.Channel.Simplex.chan_val ->
p: Steel.Channel.Simplex.prot{Steel.Channel.Protocol.more p} ->
c: Steel.Channel.Simplex.chan_t q ->
vs: Steel.Channel.Simplex.chan_val ->
vr: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.HigherReference.ref",
"Steel.Channel.Simplex.chan_val",
"Steel.Channel.Simplex.prot",
"Prims.b2t",
"Steel.Channel.Protocol.more",
"Steel.Channel.Simplex.chan_t",
"Steel.Effect.Common.star",
"Steel.HigherReference.pts_to",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__send",
"Steel.Channel.Simplex.half",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__recv",
"Steel.Channel.Simplex.trace_until",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__trace",
"Steel.Channel.Simplex.chan_inv_step",
"Steel.Channel.Simplex.in_state",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let sender_ahead (r: ref chan_val) (p: prot{more p}) #q (c: chan_t q) (vs: chan_val) (vr: chan_val)
: vprop =
| (((((pts_to c.send half vs) `star` (pts_to c.recv half vr)) `star` (trace_until c.trace vr))
`star`
(chan_inv_step vr vs))
`star`
(in_state r p)) | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.send_pre_available | val send_pre_available : p: Steel.Channel.Simplex.sprot ->
c: Steel.Channel.Simplex.chan_t q ->
vs: Steel.Channel.Simplex.chan_val ->
vr: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | let send_pre_available (p:sprot) #q (c:chan_t q) (vs vr:chan_val) = send_recv_in_sync c.send p c vs vr | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 103,
"end_line": 271,
"start_col": 0,
"start_line": 271
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p}
let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p}
let intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)
: Steel unit (MRef.pts_to r full_perm tr)
(fun _ -> trace_until r v)
(requires fun _ -> until tr == step v.chan_prot v.chan_msg)
(ensures fun _ _ _ -> True)
= intro_pure (until tr == step v.chan_prot v.chan_msg);
intro_exists tr
(fun (tr:partial_trace_of q) ->
MRef.pts_to r full_perm tr `star`
pure (until tr == (step v.chan_prot v.chan_msg)));
()
let chan_t_sr (p:prot) (send recv:ref chan_val) = (c:chan_t p{c.send == send /\ c.recv == recv})
let intro_trace_until_init #p (c:chan_t p) (v:init_chan_val p)
: SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p))
(fun _ -> trace_until c.trace v)
= intro_pure (until (initial_trace p) == step v.chan_prot v.chan_msg);
//TODO: Not sure why I need this rewrite
rewrite_slprop (MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(fun _ -> ());
intro_exists (initial_trace p) (trace_until_prop c.trace v)
let mk_chan (#p:prot) (send recv:ref chan_val) (v:init_chan_val p)
: SteelT (chan_t_sr p send recv)
(pts_to send half v `star` pts_to recv half v)
(fun c -> chan_inv c)
= let tr: trace_ref p = MRef.alloc (extended_to #p) (initial_trace p) in
let c = Mkchan_t send recv tr in
rewrite_slprop
(MRef.pts_to tr full_perm (initial_trace p))
(MRef.pts_to c.trace full_perm (initial_trace p)) (fun _ -> ());
intro_trace_until_init c v;
rewrite_slprop
(pts_to send half v `star` pts_to recv half v)
(pts_to c.send half v `star` pts_to c.recv half v)
(fun _ -> ());
intro_chan_inv #p c v;
let c' : chan_t_sr p send recv = c in
rewrite_slprop (chan_inv c) (chan_inv c') (fun _ -> ());
return c'
let new_chan (p:prot) : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)
= let q = msg unit p in
let v : chan_val = { chan_prot = q; chan_msg = (); chan_ctr = 0 } in
let vp : init_chan_val p = v in
let send = H.alloc v in
let recv = H.alloc v in
H.share recv;
H.share send;
(* TODO: use smt_fallback *)
rewrite_slprop (pts_to send (half_perm full_perm) v `star`
pts_to send (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v)
(pts_to send half vp `star`
pts_to send half vp `star`
pts_to recv half vp `star`
pts_to recv half vp)
(fun _ -> ());
let c = mk_chan send recv vp in
intro_in_state send p vp;
intro_in_state recv p vp;
let l = Steel.SpinLock.new_lock (chan_inv c) in
let ch = { chan_chan = c; chan_lock = l } in
rewrite_slprop (in_state send p) (sender ch p) (fun _ -> ());
rewrite_slprop (in_state recv p) (receiver ch p) (fun _ -> ());
return ch
[@@__reduce__]
let send_recv_in_sync (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
pure (vs == vr) `star`
in_state r p)
[@@__reduce__]
let sender_ahead (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs `star`
in_state r p)
let update_channel (#p:sprot) #q (c:chan_t q) (x:msg_t p) (vs:chan_val) (r:ref chan_val)
: SteelT chan_val
(pts_to r full_perm vs `star` in_state_slprop p vs)
(fun vs' -> pts_to r full_perm vs' `star` (in_state_slprop (step p x) vs' `star` chan_inv_step vs vs'))
= elim_pure (in_state_prop p vs);
let vs' = next_chan_val x vs in
H.write r vs';
intro_pure (in_state_prop (step p x) vs');
intro_pure (chan_inv_step_p vs vs');
return vs' | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: Steel.Channel.Simplex.sprot ->
c: Steel.Channel.Simplex.chan_t q ->
vs: Steel.Channel.Simplex.chan_val ->
vr: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.sprot",
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan_t",
"Steel.Channel.Simplex.chan_val",
"Steel.Channel.Simplex.send_recv_in_sync",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__send",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let send_pre_available (p: sprot) #q (c: chan_t q) (vs: chan_val) (vr: chan_val) =
| send_recv_in_sync c.send p c vs vr | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.next_msg_t | val next_msg_t : x: Steel.Channel.Protocol.partial_trace_of p -> Type0 | let next_msg_t (#p:prot) (x:partial_trace_of p) = P.next_msg_t x.to | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 67,
"end_line": 296,
"start_col": 0,
"start_line": 296
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p}
let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p}
let intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)
: Steel unit (MRef.pts_to r full_perm tr)
(fun _ -> trace_until r v)
(requires fun _ -> until tr == step v.chan_prot v.chan_msg)
(ensures fun _ _ _ -> True)
= intro_pure (until tr == step v.chan_prot v.chan_msg);
intro_exists tr
(fun (tr:partial_trace_of q) ->
MRef.pts_to r full_perm tr `star`
pure (until tr == (step v.chan_prot v.chan_msg)));
()
let chan_t_sr (p:prot) (send recv:ref chan_val) = (c:chan_t p{c.send == send /\ c.recv == recv})
let intro_trace_until_init #p (c:chan_t p) (v:init_chan_val p)
: SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p))
(fun _ -> trace_until c.trace v)
= intro_pure (until (initial_trace p) == step v.chan_prot v.chan_msg);
//TODO: Not sure why I need this rewrite
rewrite_slprop (MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(fun _ -> ());
intro_exists (initial_trace p) (trace_until_prop c.trace v)
let mk_chan (#p:prot) (send recv:ref chan_val) (v:init_chan_val p)
: SteelT (chan_t_sr p send recv)
(pts_to send half v `star` pts_to recv half v)
(fun c -> chan_inv c)
= let tr: trace_ref p = MRef.alloc (extended_to #p) (initial_trace p) in
let c = Mkchan_t send recv tr in
rewrite_slprop
(MRef.pts_to tr full_perm (initial_trace p))
(MRef.pts_to c.trace full_perm (initial_trace p)) (fun _ -> ());
intro_trace_until_init c v;
rewrite_slprop
(pts_to send half v `star` pts_to recv half v)
(pts_to c.send half v `star` pts_to c.recv half v)
(fun _ -> ());
intro_chan_inv #p c v;
let c' : chan_t_sr p send recv = c in
rewrite_slprop (chan_inv c) (chan_inv c') (fun _ -> ());
return c'
let new_chan (p:prot) : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)
= let q = msg unit p in
let v : chan_val = { chan_prot = q; chan_msg = (); chan_ctr = 0 } in
let vp : init_chan_val p = v in
let send = H.alloc v in
let recv = H.alloc v in
H.share recv;
H.share send;
(* TODO: use smt_fallback *)
rewrite_slprop (pts_to send (half_perm full_perm) v `star`
pts_to send (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v)
(pts_to send half vp `star`
pts_to send half vp `star`
pts_to recv half vp `star`
pts_to recv half vp)
(fun _ -> ());
let c = mk_chan send recv vp in
intro_in_state send p vp;
intro_in_state recv p vp;
let l = Steel.SpinLock.new_lock (chan_inv c) in
let ch = { chan_chan = c; chan_lock = l } in
rewrite_slprop (in_state send p) (sender ch p) (fun _ -> ());
rewrite_slprop (in_state recv p) (receiver ch p) (fun _ -> ());
return ch
[@@__reduce__]
let send_recv_in_sync (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
pure (vs == vr) `star`
in_state r p)
[@@__reduce__]
let sender_ahead (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs `star`
in_state r p)
let update_channel (#p:sprot) #q (c:chan_t q) (x:msg_t p) (vs:chan_val) (r:ref chan_val)
: SteelT chan_val
(pts_to r full_perm vs `star` in_state_slprop p vs)
(fun vs' -> pts_to r full_perm vs' `star` (in_state_slprop (step p x) vs' `star` chan_inv_step vs vs'))
= elim_pure (in_state_prop p vs);
let vs' = next_chan_val x vs in
H.write r vs';
intro_pure (in_state_prop (step p x) vs');
intro_pure (chan_inv_step_p vs vs');
return vs'
[@@__reduce__]
let send_pre_available (p:sprot) #q (c:chan_t q) (vs vr:chan_val) = send_recv_in_sync c.send p c vs vr
let gather_r (#p:sprot) (r:ref chan_val) (v:chan_val)
: SteelT unit
(pts_to r half v `star` in_state r p)
(fun _ -> pts_to r full_perm v `star` in_state_slprop p v)
= let v' = witness_exists () in
H.higher_ref_pts_to_injective_eq #_ #_ #_ #_ #v #_ r;
H.gather #_ #_ #half #half #v #v r;
rewrite_slprop (pts_to r (sum_perm half half) v) (pts_to r full_perm v) (fun _ -> ());
rewrite_slprop (in_state_slprop p v') (in_state_slprop p v) (fun _ -> ())
let send_available (#p:sprot) #q (cc:chan q) (x:msg_t p) (vs vr:chan_val) (_:unit)
: SteelT unit (send_pre_available p #q cc.chan_chan vs vr) (fun _ -> sender cc (step p x))
= Steel.Utils.extract_pure (vs == vr);
Steel.Utils.rewrite #_ #(send_recv_in_sync cc.chan_chan.send p cc.chan_chan vs) vr vs;
elim_pure (vs == vs);
gather_r cc.chan_chan.send vs;
let next_vs = update_channel cc.chan_chan x vs cc.chan_chan.send in
H.share cc.chan_chan.send;
intro_exists next_vs (fun (next_vs:chan_val) -> pts_to cc.chan_chan.send half next_vs `star` in_state_slprop (step p x) next_vs);
intro_chan_inv_stepT cc.chan_chan next_vs vs;
Steel.SpinLock.release cc.chan_lock | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: Steel.Channel.Protocol.partial_trace_of p -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Protocol.partial_trace_of",
"Steel.Channel.Protocol.next_msg_t",
"Prims.unit",
"Steel.Channel.Protocol.__proj__Mkpartial_trace_of__item__to"
] | [] | false | false | false | false | true | let next_msg_t (#p: prot) (x: partial_trace_of p) =
| P.next_msg_t x.to | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.extensible | val extensible : x: Steel.Channel.Protocol.partial_trace_of p -> Prims.GTot Prims.bool | let extensible (#p:prot) (x:partial_trace_of p) = P.more x.to | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 61,
"end_line": 295,
"start_col": 0,
"start_line": 295
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p}
let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p}
let intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)
: Steel unit (MRef.pts_to r full_perm tr)
(fun _ -> trace_until r v)
(requires fun _ -> until tr == step v.chan_prot v.chan_msg)
(ensures fun _ _ _ -> True)
= intro_pure (until tr == step v.chan_prot v.chan_msg);
intro_exists tr
(fun (tr:partial_trace_of q) ->
MRef.pts_to r full_perm tr `star`
pure (until tr == (step v.chan_prot v.chan_msg)));
()
let chan_t_sr (p:prot) (send recv:ref chan_val) = (c:chan_t p{c.send == send /\ c.recv == recv})
let intro_trace_until_init #p (c:chan_t p) (v:init_chan_val p)
: SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p))
(fun _ -> trace_until c.trace v)
= intro_pure (until (initial_trace p) == step v.chan_prot v.chan_msg);
//TODO: Not sure why I need this rewrite
rewrite_slprop (MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(fun _ -> ());
intro_exists (initial_trace p) (trace_until_prop c.trace v)
let mk_chan (#p:prot) (send recv:ref chan_val) (v:init_chan_val p)
: SteelT (chan_t_sr p send recv)
(pts_to send half v `star` pts_to recv half v)
(fun c -> chan_inv c)
= let tr: trace_ref p = MRef.alloc (extended_to #p) (initial_trace p) in
let c = Mkchan_t send recv tr in
rewrite_slprop
(MRef.pts_to tr full_perm (initial_trace p))
(MRef.pts_to c.trace full_perm (initial_trace p)) (fun _ -> ());
intro_trace_until_init c v;
rewrite_slprop
(pts_to send half v `star` pts_to recv half v)
(pts_to c.send half v `star` pts_to c.recv half v)
(fun _ -> ());
intro_chan_inv #p c v;
let c' : chan_t_sr p send recv = c in
rewrite_slprop (chan_inv c) (chan_inv c') (fun _ -> ());
return c'
let new_chan (p:prot) : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)
= let q = msg unit p in
let v : chan_val = { chan_prot = q; chan_msg = (); chan_ctr = 0 } in
let vp : init_chan_val p = v in
let send = H.alloc v in
let recv = H.alloc v in
H.share recv;
H.share send;
(* TODO: use smt_fallback *)
rewrite_slprop (pts_to send (half_perm full_perm) v `star`
pts_to send (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v)
(pts_to send half vp `star`
pts_to send half vp `star`
pts_to recv half vp `star`
pts_to recv half vp)
(fun _ -> ());
let c = mk_chan send recv vp in
intro_in_state send p vp;
intro_in_state recv p vp;
let l = Steel.SpinLock.new_lock (chan_inv c) in
let ch = { chan_chan = c; chan_lock = l } in
rewrite_slprop (in_state send p) (sender ch p) (fun _ -> ());
rewrite_slprop (in_state recv p) (receiver ch p) (fun _ -> ());
return ch
[@@__reduce__]
let send_recv_in_sync (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
pure (vs == vr) `star`
in_state r p)
[@@__reduce__]
let sender_ahead (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs `star`
in_state r p)
let update_channel (#p:sprot) #q (c:chan_t q) (x:msg_t p) (vs:chan_val) (r:ref chan_val)
: SteelT chan_val
(pts_to r full_perm vs `star` in_state_slprop p vs)
(fun vs' -> pts_to r full_perm vs' `star` (in_state_slprop (step p x) vs' `star` chan_inv_step vs vs'))
= elim_pure (in_state_prop p vs);
let vs' = next_chan_val x vs in
H.write r vs';
intro_pure (in_state_prop (step p x) vs');
intro_pure (chan_inv_step_p vs vs');
return vs'
[@@__reduce__]
let send_pre_available (p:sprot) #q (c:chan_t q) (vs vr:chan_val) = send_recv_in_sync c.send p c vs vr
let gather_r (#p:sprot) (r:ref chan_val) (v:chan_val)
: SteelT unit
(pts_to r half v `star` in_state r p)
(fun _ -> pts_to r full_perm v `star` in_state_slprop p v)
= let v' = witness_exists () in
H.higher_ref_pts_to_injective_eq #_ #_ #_ #_ #v #_ r;
H.gather #_ #_ #half #half #v #v r;
rewrite_slprop (pts_to r (sum_perm half half) v) (pts_to r full_perm v) (fun _ -> ());
rewrite_slprop (in_state_slprop p v') (in_state_slprop p v) (fun _ -> ())
let send_available (#p:sprot) #q (cc:chan q) (x:msg_t p) (vs vr:chan_val) (_:unit)
: SteelT unit (send_pre_available p #q cc.chan_chan vs vr) (fun _ -> sender cc (step p x))
= Steel.Utils.extract_pure (vs == vr);
Steel.Utils.rewrite #_ #(send_recv_in_sync cc.chan_chan.send p cc.chan_chan vs) vr vs;
elim_pure (vs == vs);
gather_r cc.chan_chan.send vs;
let next_vs = update_channel cc.chan_chan x vs cc.chan_chan.send in
H.share cc.chan_chan.send;
intro_exists next_vs (fun (next_vs:chan_val) -> pts_to cc.chan_chan.send half next_vs `star` in_state_slprop (step p x) next_vs);
intro_chan_inv_stepT cc.chan_chan next_vs vs;
Steel.SpinLock.release cc.chan_lock | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: Steel.Channel.Protocol.partial_trace_of p -> Prims.GTot Prims.bool | Prims.GTot | [
"sometrivial"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Protocol.partial_trace_of",
"Steel.Channel.Protocol.more",
"Steel.Channel.Protocol.__proj__Mkpartial_trace_of__item__to",
"Prims.bool"
] | [] | false | false | false | false | false | let extensible (#p: prot) (x: partial_trace_of p) =
| P.more x.to | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.chan_inv_cond | val chan_inv_cond (vsend vrecv: chan_val) : vprop | val chan_inv_cond (vsend vrecv: chan_val) : vprop | let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 34,
"end_line": 61,
"start_col": 0,
"start_line": 58
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | vsend: Steel.Channel.Simplex.chan_val -> vrecv: Steel.Channel.Simplex.chan_val
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.chan_val",
"Prims.op_Equality",
"Prims.nat",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_ctr",
"Steel.Effect.Common.pure",
"Prims.eq2",
"Prims.bool",
"Steel.Channel.Simplex.chan_inv_step",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let chan_inv_cond (vsend vrecv: chan_val) : vprop =
| if vsend.chan_ctr = vrecv.chan_ctr then pure (vsend == vrecv) else chan_inv_step vrecv vsend | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.history_p' | val history_p' (#p: prot) (t s: partial_trace_of p) : prop | val history_p' (#p: prot) (t s: partial_trace_of p) : prop | let history_p' (#p:prot) (t:partial_trace_of p) (s:partial_trace_of p) : prop =
t `extended_to` s /\ True | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 27,
"end_line": 412,
"start_col": 0,
"start_line": 411
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p}
let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p}
let intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)
: Steel unit (MRef.pts_to r full_perm tr)
(fun _ -> trace_until r v)
(requires fun _ -> until tr == step v.chan_prot v.chan_msg)
(ensures fun _ _ _ -> True)
= intro_pure (until tr == step v.chan_prot v.chan_msg);
intro_exists tr
(fun (tr:partial_trace_of q) ->
MRef.pts_to r full_perm tr `star`
pure (until tr == (step v.chan_prot v.chan_msg)));
()
let chan_t_sr (p:prot) (send recv:ref chan_val) = (c:chan_t p{c.send == send /\ c.recv == recv})
let intro_trace_until_init #p (c:chan_t p) (v:init_chan_val p)
: SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p))
(fun _ -> trace_until c.trace v)
= intro_pure (until (initial_trace p) == step v.chan_prot v.chan_msg);
//TODO: Not sure why I need this rewrite
rewrite_slprop (MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(fun _ -> ());
intro_exists (initial_trace p) (trace_until_prop c.trace v)
let mk_chan (#p:prot) (send recv:ref chan_val) (v:init_chan_val p)
: SteelT (chan_t_sr p send recv)
(pts_to send half v `star` pts_to recv half v)
(fun c -> chan_inv c)
= let tr: trace_ref p = MRef.alloc (extended_to #p) (initial_trace p) in
let c = Mkchan_t send recv tr in
rewrite_slprop
(MRef.pts_to tr full_perm (initial_trace p))
(MRef.pts_to c.trace full_perm (initial_trace p)) (fun _ -> ());
intro_trace_until_init c v;
rewrite_slprop
(pts_to send half v `star` pts_to recv half v)
(pts_to c.send half v `star` pts_to c.recv half v)
(fun _ -> ());
intro_chan_inv #p c v;
let c' : chan_t_sr p send recv = c in
rewrite_slprop (chan_inv c) (chan_inv c') (fun _ -> ());
return c'
let new_chan (p:prot) : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)
= let q = msg unit p in
let v : chan_val = { chan_prot = q; chan_msg = (); chan_ctr = 0 } in
let vp : init_chan_val p = v in
let send = H.alloc v in
let recv = H.alloc v in
H.share recv;
H.share send;
(* TODO: use smt_fallback *)
rewrite_slprop (pts_to send (half_perm full_perm) v `star`
pts_to send (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v)
(pts_to send half vp `star`
pts_to send half vp `star`
pts_to recv half vp `star`
pts_to recv half vp)
(fun _ -> ());
let c = mk_chan send recv vp in
intro_in_state send p vp;
intro_in_state recv p vp;
let l = Steel.SpinLock.new_lock (chan_inv c) in
let ch = { chan_chan = c; chan_lock = l } in
rewrite_slprop (in_state send p) (sender ch p) (fun _ -> ());
rewrite_slprop (in_state recv p) (receiver ch p) (fun _ -> ());
return ch
[@@__reduce__]
let send_recv_in_sync (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
pure (vs == vr) `star`
in_state r p)
[@@__reduce__]
let sender_ahead (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs `star`
in_state r p)
let update_channel (#p:sprot) #q (c:chan_t q) (x:msg_t p) (vs:chan_val) (r:ref chan_val)
: SteelT chan_val
(pts_to r full_perm vs `star` in_state_slprop p vs)
(fun vs' -> pts_to r full_perm vs' `star` (in_state_slprop (step p x) vs' `star` chan_inv_step vs vs'))
= elim_pure (in_state_prop p vs);
let vs' = next_chan_val x vs in
H.write r vs';
intro_pure (in_state_prop (step p x) vs');
intro_pure (chan_inv_step_p vs vs');
return vs'
[@@__reduce__]
let send_pre_available (p:sprot) #q (c:chan_t q) (vs vr:chan_val) = send_recv_in_sync c.send p c vs vr
let gather_r (#p:sprot) (r:ref chan_val) (v:chan_val)
: SteelT unit
(pts_to r half v `star` in_state r p)
(fun _ -> pts_to r full_perm v `star` in_state_slprop p v)
= let v' = witness_exists () in
H.higher_ref_pts_to_injective_eq #_ #_ #_ #_ #v #_ r;
H.gather #_ #_ #half #half #v #v r;
rewrite_slprop (pts_to r (sum_perm half half) v) (pts_to r full_perm v) (fun _ -> ());
rewrite_slprop (in_state_slprop p v') (in_state_slprop p v) (fun _ -> ())
let send_available (#p:sprot) #q (cc:chan q) (x:msg_t p) (vs vr:chan_val) (_:unit)
: SteelT unit (send_pre_available p #q cc.chan_chan vs vr) (fun _ -> sender cc (step p x))
= Steel.Utils.extract_pure (vs == vr);
Steel.Utils.rewrite #_ #(send_recv_in_sync cc.chan_chan.send p cc.chan_chan vs) vr vs;
elim_pure (vs == vs);
gather_r cc.chan_chan.send vs;
let next_vs = update_channel cc.chan_chan x vs cc.chan_chan.send in
H.share cc.chan_chan.send;
intro_exists next_vs (fun (next_vs:chan_val) -> pts_to cc.chan_chan.send half next_vs `star` in_state_slprop (step p x) next_vs);
intro_chan_inv_stepT cc.chan_chan next_vs vs;
Steel.SpinLock.release cc.chan_lock
let extensible (#p:prot) (x:partial_trace_of p) = P.more x.to
let next_msg_t (#p:prot) (x:partial_trace_of p) = P.next_msg_t x.to
let next_trace #p (vr:chan_val) (vs:chan_val)
(tr:partial_trace_of p)
(s:squash (until tr == step vr.chan_prot vr.chan_msg))
(_:squash (chan_inv_step_p vr vs))
: (ts:partial_trace_of p { until ts == step vs.chan_prot vs.chan_msg })
= let msg : next_msg_t tr = vs.chan_msg in
assert (extensible tr);
extend_partial_trace tr msg
let next_trace_st #p (vr:chan_val) (vs:chan_val) (tr:partial_trace_of p)
: Steel (extension_of tr)
(chan_inv_step vr vs)
(fun _ -> emp)
(requires fun _ -> until tr == step vr.chan_prot vr.chan_msg)
(ensures fun _ ts _ -> until ts == step vs.chan_prot vs.chan_msg)
= elim_pure (chan_inv_step_p vr vs);
let ts : extension_of tr = next_trace vr vs tr () () in
return ts
let update_trace #p (r:trace_ref p) (vr:chan_val) (vs:chan_val)
: Steel unit
(trace_until r vr)
(fun _ -> trace_until r vs)
(requires fun _ -> chan_inv_step_p vr vs)
(ensures fun _ _ _ -> True)
= intro_pure (chan_inv_step_p vr vs);
let tr = MRef.read_refine r in
elim_pure (until tr == step vr.chan_prot vr.chan_msg);
let ts : extension_of tr = next_trace_st vr vs tr in
MRef.write r ts;
intro_pure (until ts == step vs.chan_prot vs.chan_msg);
intro_exists ts
(fun (ts:partial_trace_of p) ->
MRef.pts_to r full_perm ts `star`
pure (until ts == step vs.chan_prot vs.chan_msg))
let recv_availableT (#p:sprot) #q (cc:chan q) (vs vr:chan_val) (_:unit)
: SteelT (msg_t p)
(sender_ahead cc.chan_chan.recv p cc.chan_chan vs vr)
(fun x -> receiver cc (step p x))
= elim_pure (chan_inv_step_p vr vs);
gather_r cc.chan_chan.recv vr;
elim_pure (in_state_prop p vr);
H.write cc.chan_chan.recv vs;
H.share cc.chan_chan.recv;
assert (vs.chan_prot == p);
let vs_msg : msg_t p = vs.chan_msg in
intro_pure (in_state_prop (step p vs_msg) vs);
intro_exists vs (fun (vs:chan_val) -> pts_to cc.chan_chan.recv half vs `star` in_state_slprop (step p vs_msg) vs);
update_trace cc.chan_chan.trace vr vs;
intro_chan_inv cc.chan_chan vs;
Steel.SpinLock.release cc.chan_lock;
vs_msg
#push-options "--ide_id_info_off"
let send_receive_prelude (#p:prot) (cc:chan p)
: SteelT (chan_val & chan_val)
emp
(fun v ->
pts_to cc.chan_chan.send half (fst v) `star`
pts_to cc.chan_chan.recv half (snd v) `star`
trace_until cc.chan_chan.trace (snd v) `star`
chan_inv_cond (fst v) (snd v))
= let c = cc.chan_chan in
Steel.SpinLock.acquire cc.chan_lock;
let vs = read_refine (chan_inv_recv cc.chan_chan) cc.chan_chan.send in
let _ = witness_exists () in
let vr = H.read cc.chan_chan.recv in
rewrite_slprop (trace_until _ _ `star` chan_inv_cond _ _)
(trace_until cc.chan_chan.trace vr `star` chan_inv_cond vs vr)
(fun _ -> ());
return (vs, vr)
let rec send (#p:prot) (c:chan p) (#next:prot{more next}) (x:msg_t next)
: SteelT unit (sender c next) (fun _ -> sender c (step next x))
= let v = send_receive_prelude c in //matching v as vs,vr fails
if (fst v).chan_ctr = (snd v).chan_ctr
then (
rewrite_slprop (chan_inv_cond (fst v) (snd v))
(pure (fst v == snd v))
(fun _ -> ());
send_available c x (fst v) (snd v) () //TODO: inlining send_availableT here fails
)
else (
rewrite_slprop (chan_inv_cond (fst v) (snd v))
(chan_inv_step (snd v) (fst v))
(fun _ -> ());
intro_chan_inv_stepT c.chan_chan (fst v) (snd v);
Steel.SpinLock.release c.chan_lock;
send c x
)
let rec recv (#p:prot) (#next:prot{more next}) (c:chan p)
: SteelT (msg_t next) (receiver c next) (fun x -> receiver c (step next x))
= let v = send_receive_prelude c in
if (fst v).chan_ctr = (snd v).chan_ctr
then (
rewrite_slprop (chan_inv_cond (fst v) (snd v))
(pure (fst v == snd v))
(fun _ -> ());
elim_pure (fst v == snd v);
intro_chan_inv_eqT c.chan_chan (fst v) (snd v);
Steel.SpinLock.release c.chan_lock;
recv c
)
else (
rewrite_slprop (chan_inv_cond (fst v) (snd v))
(chan_inv_step (snd v) (fst v))
(fun _ -> ());
recv_availableT c (fst v) (snd v) ()
) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: Steel.Channel.Protocol.partial_trace_of p -> s: Steel.Channel.Protocol.partial_trace_of p
-> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Protocol.partial_trace_of",
"Prims.l_and",
"Steel.Channel.Protocol.extended_to",
"Prims.l_True",
"Prims.prop"
] | [] | false | false | false | false | true | let history_p' (#p: prot) (t s: partial_trace_of p) : prop =
| t `extended_to` s /\ True | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.history | val history (#p:prot) (c:chan p) (t:partial_trace_of p) : Type0 | val history (#p:prot) (c:chan p) (t:partial_trace_of p) : Type0 | let history (#p:prot) (c:chan p) (t:partial_trace_of p) : Type0 =
MRef.witnessed c.chan_chan.trace (history_p t) | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 48,
"end_line": 418,
"start_col": 0,
"start_line": 417
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p}
let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p}
let intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)
: Steel unit (MRef.pts_to r full_perm tr)
(fun _ -> trace_until r v)
(requires fun _ -> until tr == step v.chan_prot v.chan_msg)
(ensures fun _ _ _ -> True)
= intro_pure (until tr == step v.chan_prot v.chan_msg);
intro_exists tr
(fun (tr:partial_trace_of q) ->
MRef.pts_to r full_perm tr `star`
pure (until tr == (step v.chan_prot v.chan_msg)));
()
let chan_t_sr (p:prot) (send recv:ref chan_val) = (c:chan_t p{c.send == send /\ c.recv == recv})
let intro_trace_until_init #p (c:chan_t p) (v:init_chan_val p)
: SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p))
(fun _ -> trace_until c.trace v)
= intro_pure (until (initial_trace p) == step v.chan_prot v.chan_msg);
//TODO: Not sure why I need this rewrite
rewrite_slprop (MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(fun _ -> ());
intro_exists (initial_trace p) (trace_until_prop c.trace v)
let mk_chan (#p:prot) (send recv:ref chan_val) (v:init_chan_val p)
: SteelT (chan_t_sr p send recv)
(pts_to send half v `star` pts_to recv half v)
(fun c -> chan_inv c)
= let tr: trace_ref p = MRef.alloc (extended_to #p) (initial_trace p) in
let c = Mkchan_t send recv tr in
rewrite_slprop
(MRef.pts_to tr full_perm (initial_trace p))
(MRef.pts_to c.trace full_perm (initial_trace p)) (fun _ -> ());
intro_trace_until_init c v;
rewrite_slprop
(pts_to send half v `star` pts_to recv half v)
(pts_to c.send half v `star` pts_to c.recv half v)
(fun _ -> ());
intro_chan_inv #p c v;
let c' : chan_t_sr p send recv = c in
rewrite_slprop (chan_inv c) (chan_inv c') (fun _ -> ());
return c'
let new_chan (p:prot) : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)
= let q = msg unit p in
let v : chan_val = { chan_prot = q; chan_msg = (); chan_ctr = 0 } in
let vp : init_chan_val p = v in
let send = H.alloc v in
let recv = H.alloc v in
H.share recv;
H.share send;
(* TODO: use smt_fallback *)
rewrite_slprop (pts_to send (half_perm full_perm) v `star`
pts_to send (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v)
(pts_to send half vp `star`
pts_to send half vp `star`
pts_to recv half vp `star`
pts_to recv half vp)
(fun _ -> ());
let c = mk_chan send recv vp in
intro_in_state send p vp;
intro_in_state recv p vp;
let l = Steel.SpinLock.new_lock (chan_inv c) in
let ch = { chan_chan = c; chan_lock = l } in
rewrite_slprop (in_state send p) (sender ch p) (fun _ -> ());
rewrite_slprop (in_state recv p) (receiver ch p) (fun _ -> ());
return ch
[@@__reduce__]
let send_recv_in_sync (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
pure (vs == vr) `star`
in_state r p)
[@@__reduce__]
let sender_ahead (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs `star`
in_state r p)
let update_channel (#p:sprot) #q (c:chan_t q) (x:msg_t p) (vs:chan_val) (r:ref chan_val)
: SteelT chan_val
(pts_to r full_perm vs `star` in_state_slprop p vs)
(fun vs' -> pts_to r full_perm vs' `star` (in_state_slprop (step p x) vs' `star` chan_inv_step vs vs'))
= elim_pure (in_state_prop p vs);
let vs' = next_chan_val x vs in
H.write r vs';
intro_pure (in_state_prop (step p x) vs');
intro_pure (chan_inv_step_p vs vs');
return vs'
[@@__reduce__]
let send_pre_available (p:sprot) #q (c:chan_t q) (vs vr:chan_val) = send_recv_in_sync c.send p c vs vr
let gather_r (#p:sprot) (r:ref chan_val) (v:chan_val)
: SteelT unit
(pts_to r half v `star` in_state r p)
(fun _ -> pts_to r full_perm v `star` in_state_slprop p v)
= let v' = witness_exists () in
H.higher_ref_pts_to_injective_eq #_ #_ #_ #_ #v #_ r;
H.gather #_ #_ #half #half #v #v r;
rewrite_slprop (pts_to r (sum_perm half half) v) (pts_to r full_perm v) (fun _ -> ());
rewrite_slprop (in_state_slprop p v') (in_state_slprop p v) (fun _ -> ())
let send_available (#p:sprot) #q (cc:chan q) (x:msg_t p) (vs vr:chan_val) (_:unit)
: SteelT unit (send_pre_available p #q cc.chan_chan vs vr) (fun _ -> sender cc (step p x))
= Steel.Utils.extract_pure (vs == vr);
Steel.Utils.rewrite #_ #(send_recv_in_sync cc.chan_chan.send p cc.chan_chan vs) vr vs;
elim_pure (vs == vs);
gather_r cc.chan_chan.send vs;
let next_vs = update_channel cc.chan_chan x vs cc.chan_chan.send in
H.share cc.chan_chan.send;
intro_exists next_vs (fun (next_vs:chan_val) -> pts_to cc.chan_chan.send half next_vs `star` in_state_slprop (step p x) next_vs);
intro_chan_inv_stepT cc.chan_chan next_vs vs;
Steel.SpinLock.release cc.chan_lock
let extensible (#p:prot) (x:partial_trace_of p) = P.more x.to
let next_msg_t (#p:prot) (x:partial_trace_of p) = P.next_msg_t x.to
let next_trace #p (vr:chan_val) (vs:chan_val)
(tr:partial_trace_of p)
(s:squash (until tr == step vr.chan_prot vr.chan_msg))
(_:squash (chan_inv_step_p vr vs))
: (ts:partial_trace_of p { until ts == step vs.chan_prot vs.chan_msg })
= let msg : next_msg_t tr = vs.chan_msg in
assert (extensible tr);
extend_partial_trace tr msg
let next_trace_st #p (vr:chan_val) (vs:chan_val) (tr:partial_trace_of p)
: Steel (extension_of tr)
(chan_inv_step vr vs)
(fun _ -> emp)
(requires fun _ -> until tr == step vr.chan_prot vr.chan_msg)
(ensures fun _ ts _ -> until ts == step vs.chan_prot vs.chan_msg)
= elim_pure (chan_inv_step_p vr vs);
let ts : extension_of tr = next_trace vr vs tr () () in
return ts
let update_trace #p (r:trace_ref p) (vr:chan_val) (vs:chan_val)
: Steel unit
(trace_until r vr)
(fun _ -> trace_until r vs)
(requires fun _ -> chan_inv_step_p vr vs)
(ensures fun _ _ _ -> True)
= intro_pure (chan_inv_step_p vr vs);
let tr = MRef.read_refine r in
elim_pure (until tr == step vr.chan_prot vr.chan_msg);
let ts : extension_of tr = next_trace_st vr vs tr in
MRef.write r ts;
intro_pure (until ts == step vs.chan_prot vs.chan_msg);
intro_exists ts
(fun (ts:partial_trace_of p) ->
MRef.pts_to r full_perm ts `star`
pure (until ts == step vs.chan_prot vs.chan_msg))
let recv_availableT (#p:sprot) #q (cc:chan q) (vs vr:chan_val) (_:unit)
: SteelT (msg_t p)
(sender_ahead cc.chan_chan.recv p cc.chan_chan vs vr)
(fun x -> receiver cc (step p x))
= elim_pure (chan_inv_step_p vr vs);
gather_r cc.chan_chan.recv vr;
elim_pure (in_state_prop p vr);
H.write cc.chan_chan.recv vs;
H.share cc.chan_chan.recv;
assert (vs.chan_prot == p);
let vs_msg : msg_t p = vs.chan_msg in
intro_pure (in_state_prop (step p vs_msg) vs);
intro_exists vs (fun (vs:chan_val) -> pts_to cc.chan_chan.recv half vs `star` in_state_slprop (step p vs_msg) vs);
update_trace cc.chan_chan.trace vr vs;
intro_chan_inv cc.chan_chan vs;
Steel.SpinLock.release cc.chan_lock;
vs_msg
#push-options "--ide_id_info_off"
let send_receive_prelude (#p:prot) (cc:chan p)
: SteelT (chan_val & chan_val)
emp
(fun v ->
pts_to cc.chan_chan.send half (fst v) `star`
pts_to cc.chan_chan.recv half (snd v) `star`
trace_until cc.chan_chan.trace (snd v) `star`
chan_inv_cond (fst v) (snd v))
= let c = cc.chan_chan in
Steel.SpinLock.acquire cc.chan_lock;
let vs = read_refine (chan_inv_recv cc.chan_chan) cc.chan_chan.send in
let _ = witness_exists () in
let vr = H.read cc.chan_chan.recv in
rewrite_slprop (trace_until _ _ `star` chan_inv_cond _ _)
(trace_until cc.chan_chan.trace vr `star` chan_inv_cond vs vr)
(fun _ -> ());
return (vs, vr)
let rec send (#p:prot) (c:chan p) (#next:prot{more next}) (x:msg_t next)
: SteelT unit (sender c next) (fun _ -> sender c (step next x))
= let v = send_receive_prelude c in //matching v as vs,vr fails
if (fst v).chan_ctr = (snd v).chan_ctr
then (
rewrite_slprop (chan_inv_cond (fst v) (snd v))
(pure (fst v == snd v))
(fun _ -> ());
send_available c x (fst v) (snd v) () //TODO: inlining send_availableT here fails
)
else (
rewrite_slprop (chan_inv_cond (fst v) (snd v))
(chan_inv_step (snd v) (fst v))
(fun _ -> ());
intro_chan_inv_stepT c.chan_chan (fst v) (snd v);
Steel.SpinLock.release c.chan_lock;
send c x
)
let rec recv (#p:prot) (#next:prot{more next}) (c:chan p)
: SteelT (msg_t next) (receiver c next) (fun x -> receiver c (step next x))
= let v = send_receive_prelude c in
if (fst v).chan_ctr = (snd v).chan_ctr
then (
rewrite_slprop (chan_inv_cond (fst v) (snd v))
(pure (fst v == snd v))
(fun _ -> ());
elim_pure (fst v == snd v);
intro_chan_inv_eqT c.chan_chan (fst v) (snd v);
Steel.SpinLock.release c.chan_lock;
recv c
)
else (
rewrite_slprop (chan_inv_cond (fst v) (snd v))
(chan_inv_step (snd v) (fst v))
(fun _ -> ());
recv_availableT c (fst v) (snd v) ()
)
let history_p' (#p:prot) (t:partial_trace_of p) (s:partial_trace_of p) : prop =
t `extended_to` s /\ True
let history_p (#p:prot) (t:partial_trace_of p) : MRef.stable_property extended_to =
history_p' t | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Steel.Channel.Simplex.chan p -> t: Steel.Channel.Protocol.partial_trace_of p -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Simplex.chan",
"Steel.Channel.Protocol.partial_trace_of",
"Steel.MonotonicHigherReference.witnessed",
"Steel.Channel.Protocol.extended_to",
"Steel.Channel.Simplex.__proj__Mkchan_t__item__trace",
"Steel.Channel.Simplex.__proj__Mkchan__item__chan_chan",
"Steel.Channel.Simplex.history_p"
] | [] | false | false | false | false | true | let history (#p: prot) (c: chan p) (t: partial_trace_of p) : Type0 =
| MRef.witnessed c.chan_chan.trace (history_p t) | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.next_chan_val | val next_chan_val (#p: sprot) (x: msg_t p) (vs0: chan_val{in_state_prop p vs0})
: Tot (vs: chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs}) | val next_chan_val (#p: sprot) (x: msg_t p) (vs0: chan_val{in_state_prop p vs0})
: Tot (vs: chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs}) | let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
} | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 140,
"start_col": 0,
"start_line": 134
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
x: Steel.Channel.Protocol.msg_t p ->
vs0: Steel.Channel.Simplex.chan_val{Steel.Channel.Simplex.in_state_prop p vs0}
-> vs:
Steel.Channel.Simplex.chan_val
{ Steel.Channel.Simplex.in_state_prop (Steel.Channel.Simplex.step p x) vs /\
Steel.Channel.Simplex.chan_inv_step_p vs0 vs } | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.sprot",
"Steel.Channel.Protocol.msg_t",
"Steel.Channel.Simplex.chan_val",
"Steel.Channel.Simplex.in_state_prop",
"Steel.Channel.Simplex.Mkchan_val",
"Steel.Channel.Simplex.step",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_prot",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_msg",
"Prims.op_Addition",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_ctr",
"Prims.l_and",
"Steel.Channel.Simplex.chan_inv_step_p"
] | [] | false | false | false | false | false | let next_chan_val (#p: sprot) (x: msg_t p) (vs0: chan_val{in_state_prop p vs0})
: Tot (vs: chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs}) =
| { chan_prot = (step vs0.chan_prot vs0.chan_msg); chan_msg = x; chan_ctr = vs0.chan_ctr + 1 } | false |
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.initial_trace | val initial_trace (p: prot) : (q: partial_trace_of p {until q == p}) | val initial_trace (p: prot) : (q: partial_trace_of p {until q == p}) | let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p} | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 27,
"end_line": 169,
"start_col": 0,
"start_line": 168
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p} | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Steel.Channel.Simplex.prot
-> q: Steel.Channel.Protocol.partial_trace_of p {Steel.Channel.Protocol.until q == p} | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Simplex.prot",
"Steel.Channel.Protocol.Mkpartial_trace_of",
"Steel.Channel.Protocol.Waiting",
"Steel.Channel.Protocol.partial_trace_of",
"Prims.eq2",
"Steel.Channel.Protocol.protocol",
"Prims.unit",
"Steel.Channel.Protocol.until"
] | [] | false | false | false | false | false | let initial_trace (p: prot) : (q: partial_trace_of p {until q == p}) =
| { to = p; tr = Waiting p } | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.u1024 | val u1024 : Type0 | let u1024 = lbuffer uint64 16ul | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 26,
"start_col": 0,
"start_line": 26
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | true | let u1024 =
| lbuffer uint64 16ul | false |
|
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.felem | val felem : Type0 | let felem = lbuffer uint64 4ul | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 28,
"start_col": 0,
"start_line": 28
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | true | let felem =
| lbuffer uint64 4ul | false |
|
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.u256 | val u256 : Type0 | let u256 = lbuffer uint64 4ul | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 24,
"start_col": 0,
"start_line": 24
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | true | let u256 =
| lbuffer uint64 4ul | false |
|
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.u512 | val u512 : Type0 | let u512 = lbuffer uint64 8ul | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 25,
"start_col": 0,
"start_line": 25
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | true | let u512 =
| lbuffer uint64 8ul | false |
|
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.felem2 | val felem2 : Type0 | let felem2 = lbuffer uint64 8ul | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 29,
"start_col": 0,
"start_line": 29
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | true | let felem2 =
| lbuffer uint64 8ul | false |
|
Steel.Channel.Simplex.fst | Steel.Channel.Simplex.next_trace | val next_trace:
#p: _ ->
vr: chan_val ->
vs: chan_val ->
tr: partial_trace_of p ->
s: squash (until tr == step vr.chan_prot vr.chan_msg) ->
squash (chan_inv_step_p vr vs)
-> (ts: partial_trace_of p {until ts == step vs.chan_prot vs.chan_msg}) | val next_trace:
#p: _ ->
vr: chan_val ->
vs: chan_val ->
tr: partial_trace_of p ->
s: squash (until tr == step vr.chan_prot vr.chan_msg) ->
squash (chan_inv_step_p vr vs)
-> (ts: partial_trace_of p {until ts == step vs.chan_prot vs.chan_msg}) | let next_trace #p (vr:chan_val) (vs:chan_val)
(tr:partial_trace_of p)
(s:squash (until tr == step vr.chan_prot vr.chan_msg))
(_:squash (chan_inv_step_p vr vs))
: (ts:partial_trace_of p { until ts == step vs.chan_prot vs.chan_msg })
= let msg : next_msg_t tr = vs.chan_msg in
assert (extensible tr);
extend_partial_trace tr msg | {
"file_name": "lib/steel/Steel.Channel.Simplex.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 32,
"end_line": 305,
"start_col": 0,
"start_line": 298
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Channel.Simplex
module P = Steel.Channel.Protocol
open Steel.SpinLock
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.HigherReference
open Steel.FractionalPermission
module MRef = Steel.MonotonicHigherReference
module H = Steel.HigherReference
let sprot = p:prot { more p }
noeq
type chan_val = {
chan_prot : sprot;
chan_msg : msg_t chan_prot;
chan_ctr : nat
}
let mref a p = MRef.ref a p
let trace_ref (p:prot) = mref (partial_trace_of p) extended_to
noeq
type chan_t (p:prot) = {
send: ref chan_val;
recv: ref chan_val;
trace: trace_ref p;
}
let half : perm = half_perm full_perm
let step (s:sprot) (x:msg_t s) = step s x
let chan_inv_step_p (vrecv vsend:chan_val) : prop =
(vsend.chan_prot == step vrecv.chan_prot vrecv.chan_msg /\
vsend.chan_ctr == vrecv.chan_ctr + 1)
let chan_inv_step (vrecv vsend:chan_val) : vprop =
pure (chan_inv_step_p vrecv vsend)
let chan_inv_cond (vsend:chan_val) (vrecv:chan_val) : vprop =
if vsend.chan_ctr = vrecv.chan_ctr
then pure (vsend == vrecv)
else chan_inv_step vrecv vsend
let trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =
MRef.pts_to r full_perm tr `star`
pure (until tr == step vr.chan_prot vr.chan_msg)
let trace_until #p (r:trace_ref p) (vr:chan_val) =
h_exists (trace_until_prop r vr)
let chan_inv_recv #p (c:chan_t p) (vsend:chan_val) =
h_exists (fun (vrecv:chan_val) ->
pts_to c.recv half vrecv `star`
trace_until c.trace vrecv `star`
chan_inv_cond vsend vrecv)
let chan_inv #p (c:chan_t p) : vprop =
h_exists (fun (vsend:chan_val) ->
pts_to c.send half vsend `star` chan_inv_recv c vsend)
let intro_chan_inv_cond_eqT (vs vr:chan_val)
: Steel unit emp
(fun _ -> chan_inv_cond vs vr)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_pure (vs == vs);
rewrite_slprop (chan_inv_cond vs vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_cond_stepT (vs vr:chan_val)
: SteelT unit (chan_inv_step vr vs)
(fun _ -> chan_inv_cond vs vr)
= Steel.Utils.extract_pure (chan_inv_step_p vr vs);
rewrite_slprop (chan_inv_step vr vs) (chan_inv_cond vs vr) (fun _ -> ())
let intro_chan_inv_auxT #p (#vs : chan_val)
(#vr : chan_val)
(c:chan_t p)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_cond vs vr)
(fun _ -> chan_inv c)
= intro_exists _ (fun (vr:chan_val) -> pts_to c.recv half vr `star` trace_until c.trace vr `star` chan_inv_cond vs vr);
intro_exists _ (fun (vs:chan_val) -> pts_to c.send half vs `star` chan_inv_recv c vs)
let intro_chan_inv_stepT #p (c:chan_t p) (vs vr:chan_val)
: SteelT unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs)
(fun _ -> chan_inv c)
= intro_chan_inv_cond_stepT vs vr;
intro_chan_inv_auxT c
let intro_chan_inv_eqT #p (c:chan_t p) (vs vr:chan_val)
: Steel unit (pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr)
(fun _ -> chan_inv c)
(requires fun _ -> vs == vr)
(ensures fun _ _ _ -> True)
= intro_chan_inv_cond_eqT vs vr;
intro_chan_inv_auxT c
noeq
type chan p = {
chan_chan : chan_t p;
chan_lock : lock (chan_inv chan_chan)
}
let in_state_prop (p:prot) (vsend:chan_val) : prop =
p == step vsend.chan_prot vsend.chan_msg
irreducible
let next_chan_val (#p:sprot) (x:msg_t p) (vs0:chan_val { in_state_prop p vs0 })
: Tot (vs:chan_val{in_state_prop (step p x) vs /\ chan_inv_step_p vs0 vs})
= {
chan_prot = (step vs0.chan_prot vs0.chan_msg);
chan_msg = x;
chan_ctr = vs0.chan_ctr + 1
}
[@@__reduce__]
let in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)
let in_state (r:ref chan_val) (p:prot) =
h_exists (fun (vsend:chan_val) ->
pts_to r half vsend `star` in_state_slprop p vsend)
let sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p
let receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p
let intro_chan_inv #p (c:chan_t p) (v:chan_val)
: SteelT unit (pts_to c.send half v `star`
pts_to c.recv half v `star`
trace_until c.trace v)
(fun _ -> chan_inv c)
= intro_chan_inv_eqT c v v
let chan_val_p (p:prot) = (vs0:chan_val { in_state_prop p vs0 })
let intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)
: SteelT unit (pts_to r half v) (fun _ -> in_state r p)
= intro_pure (in_state_prop p v);
intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)
let msg t p = Msg Send unit (fun _ -> p)
let init_chan_val (p:prot) = v:chan_val {v.chan_prot == msg unit p}
let initial_trace (p:prot) : (q:partial_trace_of p {until q == p})
= { to = p; tr=Waiting p}
let intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)
: Steel unit (MRef.pts_to r full_perm tr)
(fun _ -> trace_until r v)
(requires fun _ -> until tr == step v.chan_prot v.chan_msg)
(ensures fun _ _ _ -> True)
= intro_pure (until tr == step v.chan_prot v.chan_msg);
intro_exists tr
(fun (tr:partial_trace_of q) ->
MRef.pts_to r full_perm tr `star`
pure (until tr == (step v.chan_prot v.chan_msg)));
()
let chan_t_sr (p:prot) (send recv:ref chan_val) = (c:chan_t p{c.send == send /\ c.recv == recv})
let intro_trace_until_init #p (c:chan_t p) (v:init_chan_val p)
: SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p))
(fun _ -> trace_until c.trace v)
= intro_pure (until (initial_trace p) == step v.chan_prot v.chan_msg);
//TODO: Not sure why I need this rewrite
rewrite_slprop (MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(MRef.pts_to c.trace full_perm (initial_trace p) `star`
pure (until (initial_trace p) == step v.chan_prot v.chan_msg))
(fun _ -> ());
intro_exists (initial_trace p) (trace_until_prop c.trace v)
let mk_chan (#p:prot) (send recv:ref chan_val) (v:init_chan_val p)
: SteelT (chan_t_sr p send recv)
(pts_to send half v `star` pts_to recv half v)
(fun c -> chan_inv c)
= let tr: trace_ref p = MRef.alloc (extended_to #p) (initial_trace p) in
let c = Mkchan_t send recv tr in
rewrite_slprop
(MRef.pts_to tr full_perm (initial_trace p))
(MRef.pts_to c.trace full_perm (initial_trace p)) (fun _ -> ());
intro_trace_until_init c v;
rewrite_slprop
(pts_to send half v `star` pts_to recv half v)
(pts_to c.send half v `star` pts_to c.recv half v)
(fun _ -> ());
intro_chan_inv #p c v;
let c' : chan_t_sr p send recv = c in
rewrite_slprop (chan_inv c) (chan_inv c') (fun _ -> ());
return c'
let new_chan (p:prot) : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)
= let q = msg unit p in
let v : chan_val = { chan_prot = q; chan_msg = (); chan_ctr = 0 } in
let vp : init_chan_val p = v in
let send = H.alloc v in
let recv = H.alloc v in
H.share recv;
H.share send;
(* TODO: use smt_fallback *)
rewrite_slprop (pts_to send (half_perm full_perm) v `star`
pts_to send (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v `star`
pts_to recv (half_perm full_perm) v)
(pts_to send half vp `star`
pts_to send half vp `star`
pts_to recv half vp `star`
pts_to recv half vp)
(fun _ -> ());
let c = mk_chan send recv vp in
intro_in_state send p vp;
intro_in_state recv p vp;
let l = Steel.SpinLock.new_lock (chan_inv c) in
let ch = { chan_chan = c; chan_lock = l } in
rewrite_slprop (in_state send p) (sender ch p) (fun _ -> ());
rewrite_slprop (in_state recv p) (receiver ch p) (fun _ -> ());
return ch
[@@__reduce__]
let send_recv_in_sync (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
pure (vs == vr) `star`
in_state r p)
[@@__reduce__]
let sender_ahead (r:ref chan_val) (p:prot{more p}) #q (c:chan_t q) (vs vr:chan_val) : vprop =
(pts_to c.send half vs `star`
pts_to c.recv half vr `star`
trace_until c.trace vr `star`
chan_inv_step vr vs `star`
in_state r p)
let update_channel (#p:sprot) #q (c:chan_t q) (x:msg_t p) (vs:chan_val) (r:ref chan_val)
: SteelT chan_val
(pts_to r full_perm vs `star` in_state_slprop p vs)
(fun vs' -> pts_to r full_perm vs' `star` (in_state_slprop (step p x) vs' `star` chan_inv_step vs vs'))
= elim_pure (in_state_prop p vs);
let vs' = next_chan_val x vs in
H.write r vs';
intro_pure (in_state_prop (step p x) vs');
intro_pure (chan_inv_step_p vs vs');
return vs'
[@@__reduce__]
let send_pre_available (p:sprot) #q (c:chan_t q) (vs vr:chan_val) = send_recv_in_sync c.send p c vs vr
let gather_r (#p:sprot) (r:ref chan_val) (v:chan_val)
: SteelT unit
(pts_to r half v `star` in_state r p)
(fun _ -> pts_to r full_perm v `star` in_state_slprop p v)
= let v' = witness_exists () in
H.higher_ref_pts_to_injective_eq #_ #_ #_ #_ #v #_ r;
H.gather #_ #_ #half #half #v #v r;
rewrite_slprop (pts_to r (sum_perm half half) v) (pts_to r full_perm v) (fun _ -> ());
rewrite_slprop (in_state_slprop p v') (in_state_slprop p v) (fun _ -> ())
let send_available (#p:sprot) #q (cc:chan q) (x:msg_t p) (vs vr:chan_val) (_:unit)
: SteelT unit (send_pre_available p #q cc.chan_chan vs vr) (fun _ -> sender cc (step p x))
= Steel.Utils.extract_pure (vs == vr);
Steel.Utils.rewrite #_ #(send_recv_in_sync cc.chan_chan.send p cc.chan_chan vs) vr vs;
elim_pure (vs == vs);
gather_r cc.chan_chan.send vs;
let next_vs = update_channel cc.chan_chan x vs cc.chan_chan.send in
H.share cc.chan_chan.send;
intro_exists next_vs (fun (next_vs:chan_val) -> pts_to cc.chan_chan.send half next_vs `star` in_state_slprop (step p x) next_vs);
intro_chan_inv_stepT cc.chan_chan next_vs vs;
Steel.SpinLock.release cc.chan_lock
let extensible (#p:prot) (x:partial_trace_of p) = P.more x.to
let next_msg_t (#p:prot) (x:partial_trace_of p) = P.next_msg_t x.to | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.MonotonicHigherReference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.HigherReference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Channel.Protocol.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.Channel.Simplex.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "Steel.MonotonicHigherReference",
"short_module": "MRef"
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.HigherReference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Channel.Protocol",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel.Protocol",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Channel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
vr: Steel.Channel.Simplex.chan_val ->
vs: Steel.Channel.Simplex.chan_val ->
tr: Steel.Channel.Protocol.partial_trace_of p ->
s:
Prims.squash (Steel.Channel.Protocol.until tr ==
Steel.Channel.Simplex.step (Mkchan_val?.chan_prot vr) (Mkchan_val?.chan_msg vr)) ->
_: Prims.squash (Steel.Channel.Simplex.chan_inv_step_p vr vs)
-> ts:
Steel.Channel.Protocol.partial_trace_of p
{ Steel.Channel.Protocol.until ts ==
Steel.Channel.Simplex.step (Mkchan_val?.chan_prot vs) (Mkchan_val?.chan_msg vs) } | Prims.Tot | [
"total"
] | [] | [
"Steel.Channel.Protocol.protocol",
"Prims.unit",
"Steel.Channel.Simplex.chan_val",
"Steel.Channel.Protocol.partial_trace_of",
"Prims.squash",
"Prims.eq2",
"Steel.Channel.Protocol.until",
"Steel.Channel.Simplex.step",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_prot",
"Steel.Channel.Simplex.__proj__Mkchan_val__item__chan_msg",
"Steel.Channel.Simplex.chan_inv_step_p",
"Steel.Channel.Protocol.extend_partial_trace",
"Prims._assert",
"Prims.b2t",
"Steel.Channel.Simplex.extensible",
"Steel.Channel.Simplex.next_msg_t"
] | [] | false | false | false | false | false | let next_trace
#p
(vr: chan_val)
(vs: chan_val)
(tr: partial_trace_of p)
(s: squash (until tr == step vr.chan_prot vr.chan_msg))
(_: squash (chan_inv_step_p vr vs))
: (ts: partial_trace_of p {until ts == step vs.chan_prot vs.chan_msg}) =
| let msg:next_msg_t tr = vs.chan_msg in
assert (extensible tr);
extend_partial_trace tr msg | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.liveness_inv | val liveness_inv : Type | let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
} | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 1,
"end_line": 23,
"start_col": 0,
"start_line": 21
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.hinv",
"Prims.l_Forall",
"LowStar.Monotonic.Buffer.loc",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_imp",
"Prims.l_and",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_includes",
"LowStar.Monotonic.Buffer.address_liveness_insensitive_locs"
] | [] | false | false | false | true | true | let liveness_inv =
| i:
hinv
{ forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)}
i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1 } | false |
|
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.true_inv | val true_inv : slice_inv | val true_inv : slice_inv | let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True) | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 60,
"end_line": 29,
"start_col": 0,
"start_line": 29
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Actions.Base.slice_inv | Prims.Tot | [
"total"
] | [] | [
"FStar.FunctionalExtensionality.on",
"FStar.Monotonic.HyperStack.mem",
"Prims.prop",
"Prims.l_True",
"EverParse3d.Actions.Base.slice_inv"
] | [] | false | false | false | true | false | let true_inv:slice_inv =
| F.on HS.mem #prop (fun _ -> True) | false |
CQueue.fst | CQueue.llist_fragment_head_to_tail | val llist_fragment_head_to_tail
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
(head: ccell_ptrvalue a)
: SteelGhost (Ghost.erased (ref (ccell_ptrvalue a)))
opened
((vptr phead) `star` (llist_fragment_head l phead head))
(fun res -> (llist_fragment_tail l phead) `star` (vptr res))
(fun h -> h (vptr phead) == head)
(fun h res h' ->
let v = sel_llist_fragment_head l phead head h in
fst v == Ghost.reveal res /\ fst v == sel_llist_fragment_tail l phead h' /\
snd v == h' (vptr res))
(decreases (L.length (Ghost.reveal l))) | val llist_fragment_head_to_tail
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
(head: ccell_ptrvalue a)
: SteelGhost (Ghost.erased (ref (ccell_ptrvalue a)))
opened
((vptr phead) `star` (llist_fragment_head l phead head))
(fun res -> (llist_fragment_tail l phead) `star` (vptr res))
(fun h -> h (vptr phead) == head)
(fun h res h' ->
let v = sel_llist_fragment_head l phead head h in
fst v == Ghost.reveal res /\ fst v == sel_llist_fragment_tail l phead h' /\
snd v == h' (vptr res))
(decreases (L.length (Ghost.reveal l))) | let rec llist_fragment_head_to_tail
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
(head: ccell_ptrvalue a)
: SteelGhost (Ghost.erased (ref (ccell_ptrvalue a))) opened
(vptr phead `star` llist_fragment_head l phead head)
(fun res -> llist_fragment_tail l phead `star` vptr res)
(fun h -> h (vptr phead) == head)
(fun h res h' ->
let v = sel_llist_fragment_head l phead head h in
fst v == Ghost.reveal res /\
fst v == sel_llist_fragment_tail l phead h' /\
snd v == h' (vptr res)
)
(decreases (L.length (Ghost.reveal l)))
=
if Nil? l
then begin
let ptail = Ghost.hide phead in
let gh = gget (vptr phead) in
assert (Ghost.reveal gh == head);
elim_llist_fragment_head_nil l phead head;
intro_llist_fragment_tail_nil l phead;
change_equal_slprop
(vptr phead)
(vptr ptail);
ptail
end else begin
intro_llist_fragment_tail_nil [] phead;
change_equal_slprop
(vptr phead)
(vptr (Ghost.reveal (Ghost.hide phead)));
let uc = elim_llist_fragment_head_cons l phead head in
let head' = elim_ccell_ghost head in
change_equal_slprop
(vptr (ccell_next head'))
(vptr uc.ll_uncons_pnext);
let lc = intro_llist_fragment_tail_snoc [] phead phead head' in
let ptail = llist_fragment_head_to_tail
uc.ll_uncons_tl
uc.ll_uncons_pnext
uc.ll_uncons_next
in
let l' = llist_fragment_tail_append phead lc uc.ll_uncons_pnext uc.ll_uncons_tl in
change_equal_slprop
(llist_fragment_tail l' phead)
(llist_fragment_tail l phead);
ptail
end | {
"file_name": "share/steel/examples/steel/CQueue.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 1033,
"start_col": 0,
"start_line": 983
} | module CQueue
open CQueue.LList
#set-options "--ide_id_info_off"
//Re-define squash, since this module explicitly
//replies on proving equalities of the form `t_of v == squash p`
//which are delicate in the presence of optimizations that
//unfold `Prims.squash (p /\ q)`to _:unit{p /\ q}
//See Issue #2496
let squash (p:Type u#a) : Type0 = squash p
(* BEGIN library *)
let intro_vrewrite_no_norm (#opened:inames)
(v: vprop) (#t: Type) (f: (t_of v) -> GTot t)
: SteelGhost unit opened v (fun _ -> vrewrite v f)
(fun _ -> True) (fun h _ h' -> h' (vrewrite v f) == f (h v))
=
intro_vrewrite v f
let elim_vrewrite_no_norm (#opened:inames)
(v: vprop)
(#t: Type)
(f: ((t_of v) -> GTot t))
: SteelGhost unit opened (vrewrite v f) (fun _ -> v)
(fun _ -> True)
(fun h _ h' -> h (vrewrite v f) == f (h' v))
=
elim_vrewrite v f
let vconst_sel
(#a: Type)
(x: a)
: Tot (selector a (hp_of emp))
= fun _ -> x
[@@ __steel_reduce__]
let vconst'
(#a: Type)
(x: a)
: GTot vprop'
= {
hp = hp_of emp;
t = a;
sel = vconst_sel x;
}
[@@ __steel_reduce__]
let vconst (#a: Type) (x: a) : Tot vprop = VUnit (vconst' x)
let intro_vconst
(#opened: _)
(#a: Type)
(x: a)
: SteelGhost unit opened
emp
(fun _ -> vconst x)
(fun _ -> True)
(fun _ _ h' -> h' (vconst x) == x)
=
change_slprop_rel
emp
(vconst x)
(fun _ y -> y == x)
(fun _ -> ())
let elim_vconst
(#opened: _)
(#a: Type)
(x: a)
: SteelGhost unit opened
(vconst x)
(fun _ -> emp)
(fun _ -> True)
(fun h _ _ -> h (vconst x) == x)
=
change_slprop_rel
(vconst x)
emp
(fun y _ -> y == x)
(fun _ -> ())
let vpure_sel'
(p: prop)
: Tot (selector' (squash p) (Steel.Memory.pure p))
= fun (m: Steel.Memory.hmem (Steel.Memory.pure p)) -> pure_interp p m
let vpure_sel
(p: prop)
: Tot (selector (squash p) (Steel.Memory.pure p))
= vpure_sel' p
[@@ __steel_reduce__]
let vpure'
(p: prop)
: GTot vprop'
= {
hp = Steel.Memory.pure p;
t = squash p;
sel = vpure_sel p;
}
[@@ __steel_reduce__]
let vpure (p: prop) : Tot vprop = VUnit (vpure' p)
let intro_vpure
(#opened: _)
(p: prop)
: SteelGhost unit opened
emp
(fun _ -> vpure p)
(fun _ -> p)
(fun _ _ h' -> p)
=
change_slprop_rel
emp
(vpure p)
(fun _ _ -> p)
(fun m -> pure_interp p m)
let elim_vpure
(#opened: _)
(p: prop)
: SteelGhost unit opened
(vpure p)
(fun _ -> emp)
(fun _ -> True)
(fun _ _ _ -> p)
=
change_slprop_rel
(vpure p)
emp
(fun _ _ -> p)
(fun m -> pure_interp p m; reveal_emp (); intro_emp m)
val intro_vdep2 (#opened:inames)
(v: vprop)
(q: vprop)
(x: t_of v)
(p: (t_of v -> Tot vprop))
: SteelGhost unit opened
(v `star` q)
(fun _ -> vdep v p)
(requires (fun h ->
q == p x /\
x == h v
))
(ensures (fun h _ h' ->
let x2 = h' (vdep v p) in
q == p (h v) /\
dfst x2 == (h v) /\
dsnd x2 == (h q)
))
let intro_vdep2
v q x p
=
intro_vdep v q p
let vbind0_payload
(a: vprop)
(t: Type0)
(b: (t_of a -> Tot vprop))
(x: t_of a)
: Tot vprop
= vpure (t == t_of (b x)) `star` b x
let vbind0_rewrite
(a: vprop)
(t: Type0)
(b: (t_of a -> Tot vprop))
(x: normal (t_of (vdep a (vbind0_payload a t b))))
: Tot t
= snd (dsnd x)
[@@__steel_reduce__; __reduce__]
let vbind0
(a: vprop)
(t: Type0)
(b: (t_of a -> Tot vprop))
: Tot vprop
= a `vdep` vbind0_payload a t b `vrewrite` vbind0_rewrite a t b
let vbind_hp // necessary to hide the attribute on hp_of
(a: vprop)
(t: Type0)
(b: (t_of a -> Tot vprop))
: Tot (slprop u#1)
= hp_of (vbind0 a t b)
let vbind_sel // same for hp_sel
(a: vprop)
(t: Type0)
(b: (t_of a -> Tot vprop))
: GTot (selector t (vbind_hp a t b))
= sel_of (vbind0 a t b)
[@@__steel_reduce__]
let vbind'
(a: vprop)
(t: Type0)
(b: (t_of a -> Tot vprop))
: GTot vprop'
= {
hp = vbind_hp a t b;
t = t;
sel = vbind_sel a t b;
}
[@@__steel_reduce__]
let vbind
(a: vprop)
(t: Type0)
(b: (t_of a -> Tot vprop))
: Tot vprop
= VUnit (vbind' a t b)
let intro_vbind
(#opened: _)
(a: vprop)
(b' : vprop)
(t: Type0)
(b: (t_of a -> Tot vprop))
: SteelGhost unit opened
(a `star` b')
(fun _ -> vbind a t b)
(fun h -> t_of b' == t /\ b' == b (h a))
(fun h _ h' ->
t_of b' == t /\
b' == b (h a) /\
h' (vbind a t b) == h b'
)
=
intro_vpure (t == t_of b');
intro_vdep
a
(vpure (t == t_of b') `star` b')
(vbind0_payload a t b);
intro_vrewrite
(a `vdep` vbind0_payload a t b)
(vbind0_rewrite a t b);
change_slprop_rel
(vbind0 a t b)
(vbind a t b)
(fun x y -> x == y)
(fun _ -> ())
let elim_vbind
(#opened: _)
(a: vprop)
(t: Type0)
(b: (t_of a -> Tot vprop))
: SteelGhost (Ghost.erased (t_of a)) opened
(vbind a t b)
(fun res -> a `star` b (Ghost.reveal res))
(fun h -> True)
(fun h res h' ->
h' a == Ghost.reveal res /\
t == t_of (b (Ghost.reveal res)) /\
h' (b (Ghost.reveal res)) == h (vbind a t b)
)
=
change_slprop_rel
(vbind a t b)
(vbind0 a t b)
(fun x y -> x == y)
(fun _ -> ());
elim_vrewrite
(a `vdep` vbind0_payload a t b)
(vbind0_rewrite a t b);
let res = elim_vdep a (vbind0_payload a t b) in
change_equal_slprop
(vbind0_payload a t b (Ghost.reveal res))
(vpure (t == t_of (b (Ghost.reveal res))) `star` b (Ghost.reveal res));
elim_vpure (t == t_of (b (Ghost.reveal res)));
res
let (==) (#a:_) (x y: a) : prop = x == y
let snoc_inj (#a: Type) (hd1 hd2: list a) (tl1 tl2: a) : Lemma
(requires (hd1 `L.append` [tl1] == hd2 `L.append` [tl2]))
(ensures (hd1 == hd2 /\ tl1 == tl2))
[SMTPat (hd1 `L.append` [tl1]); SMTPat (hd2 `L.append` [tl2])]
= L.lemma_snoc_unsnoc (hd1, tl1);
L.lemma_snoc_unsnoc (hd2, tl2)
[@"opaque_to_smt"]
let unsnoc (#a: Type) (l: list a) : Pure (list a & a)
(requires (Cons? l))
(ensures (fun (hd, tl) -> l == hd `L.append` [tl] /\ L.length hd < L.length l))
=
L.lemma_unsnoc_snoc l;
L.append_length (fst (L.unsnoc l)) [snd (L.unsnoc l)];
L.unsnoc l
let unsnoc_hd (#a: Type) (l: list a) : Pure (list a) (requires (Cons? l)) (ensures (fun l' -> L.length l' <
L.length l)) = fst (unsnoc l)
let unsnoc_tl (#a: Type) (l: list a) : Pure (a) (requires (Cons? l)) (ensures (fun _ -> True)) = snd (unsnoc l)
[@@"opaque_to_smt"]
let snoc (#a: Type) (l: list a) (x: a) : Pure (list a)
(requires True)
(ensures (fun l' ->
Cons? l' /\
unsnoc_hd l' == l /\
unsnoc_tl l' == x
))
=
let l' = L.snoc (l, x) in
L.append_length l [x];
snoc_inj l (unsnoc_hd l') x (unsnoc_tl l');
l'
let snoc_unsnoc
(#a: Type)
(l: list a)
: Lemma
(requires (Cons? l))
(ensures (snoc (unsnoc_hd l) (unsnoc_tl l) == l))
= ()
unfold
let coerce
(#a: Type)
(x: a)
(b: Type)
: Pure b
(requires (a == b))
(ensures (fun y -> a == b /\ x == y))
= x
(* END library *)
let t a = cllist_lvalue a
let v (a: Type0) = list a
let datas
(#a: Type0)
(l: v a)
: Tot (list a)
= l
(* view from the tail *)
let llist_fragment_tail_cons_data_refine
(#a: Type)
(l: Ghost.erased (list a) { Cons? (Ghost.reveal l) })
(d: a)
: Tot prop
= d == unsnoc_tl (Ghost.reveal l)
[@@ __steel_reduce__]
let llist_fragment_tail_cons_lvalue_payload
(#a: Type)
(l: Ghost.erased (list a) { Cons? (Ghost.reveal l) })
(c: ccell_lvalue a)
: Tot vprop
= vptr (ccell_data c) `vrefine` llist_fragment_tail_cons_data_refine l
let ccell_is_lvalue_refine
(a: Type)
(c: ccell_ptrvalue a)
: Tot prop
= ccell_ptrvalue_is_null c == false
[@@ __steel_reduce__ ]
let llist_fragment_tail_cons_next_payload
(#a: Type)
(l: Ghost.erased (list a) { Cons? (Ghost.reveal l) })
(ptail: ref (ccell_ptrvalue a))
: Tot vprop
= vptr ptail `vrefine` ccell_is_lvalue_refine a `vdep` llist_fragment_tail_cons_lvalue_payload l
[@@ __steel_reduce__ ]
let llist_fragment_tail_cons_rewrite
(#a: Type)
(l: Ghost.erased (list a) { Cons? (Ghost.reveal l) })
(llist_fragment_tail: vprop { t_of llist_fragment_tail == ref (ccell_ptrvalue a) })
(x: normal (t_of (llist_fragment_tail `vdep` (llist_fragment_tail_cons_next_payload l))))
: Tot (ref (ccell_ptrvalue a))
= let (| _, (| c, _ |) |) = x in
ccell_next c
let rec llist_fragment_tail (#a: Type) (l: Ghost.erased (list a)) (phead: ref (ccell_ptrvalue a)) : Pure vprop
(requires True)
(ensures (fun v -> t_of v == ref (ccell_ptrvalue a)))
(decreases (Ghost.reveal (L.length l)))
= if Nil? l
then vconst phead
else llist_fragment_tail (Ghost.hide (unsnoc_hd (Ghost.reveal l))) phead `vdep` llist_fragment_tail_cons_next_payload l `vrewrite` llist_fragment_tail_cons_rewrite l (llist_fragment_tail (Ghost.hide (unsnoc_hd (Ghost.reveal l))) phead)
let llist_fragment_tail_eq
(#a: Type) (l: Ghost.erased (list a)) (phead: ref (ccell_ptrvalue a))
: Lemma
(llist_fragment_tail l phead == (
if Nil? l
then vconst phead
else llist_fragment_tail (Ghost.hide (unsnoc_hd (Ghost.reveal l))) phead `vdep` llist_fragment_tail_cons_next_payload l `vrewrite` llist_fragment_tail_cons_rewrite l (llist_fragment_tail (Ghost.hide (unsnoc_hd (Ghost.reveal l))) phead)
))
= assert_norm
(llist_fragment_tail l phead == (
if Nil? l
then vconst phead
else llist_fragment_tail (Ghost.hide (unsnoc_hd (Ghost.reveal l))) phead `vdep` llist_fragment_tail_cons_next_payload l `vrewrite` llist_fragment_tail_cons_rewrite l (llist_fragment_tail (Ghost.hide (unsnoc_hd (Ghost.reveal l))) phead)
))
let llist_fragment_tail_eq_cons
(#a: Type) (l: Ghost.erased (list a)) (phead: ref (ccell_ptrvalue a))
: Lemma
(requires (Cons? l))
(ensures (Cons? l /\
llist_fragment_tail l phead == (
llist_fragment_tail (Ghost.hide (unsnoc_hd (Ghost.reveal l))) phead `vdep` llist_fragment_tail_cons_next_payload l `vrewrite` llist_fragment_tail_cons_rewrite l (llist_fragment_tail (Ghost.hide (unsnoc_hd (Ghost.reveal l))) phead)
)))
= llist_fragment_tail_eq l phead
unfold
let sel_llist_fragment_tail
(#a:Type) (#p:vprop)
(l: Ghost.erased (list a)) (phead: ref (ccell_ptrvalue a))
(h: rmem p { FStar.Tactics.with_tactic selector_tactic (can_be_split p (llist_fragment_tail l phead) /\ True) })
: GTot (ref (ccell_ptrvalue a))
=
coerce (h (llist_fragment_tail l phead)) (ref (ccell_ptrvalue a))
val intro_llist_fragment_tail_nil
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
: SteelGhost unit opened
emp
(fun _ -> llist_fragment_tail l phead)
(fun _ -> Nil? l)
(fun _ _ h' -> sel_llist_fragment_tail l phead h' == phead)
let intro_llist_fragment_tail_nil
l phead
=
intro_vconst phead;
change_equal_slprop
(vconst phead)
(llist_fragment_tail l phead)
val elim_llist_fragment_tail_nil
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
: SteelGhost unit opened
(llist_fragment_tail l phead)
(fun _ -> emp)
(fun _ -> Nil? l)
(fun h _ _ -> sel_llist_fragment_tail l phead h == phead)
let elim_llist_fragment_tail_nil
l phead
=
change_equal_slprop
(llist_fragment_tail l phead)
(vconst phead);
elim_vconst phead
val intro_llist_fragment_tail_snoc
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
(ptail: Ghost.erased (ref (ccell_ptrvalue a)))
(tail: Ghost.erased (ccell_lvalue a))
: SteelGhost (Ghost.erased (list a)) opened
(llist_fragment_tail l phead `star` vptr ptail `star` vptr (ccell_data tail))
(fun res -> llist_fragment_tail res phead)
(fun h ->
sel_llist_fragment_tail l phead h == Ghost.reveal ptail /\
sel ptail h == Ghost.reveal tail
)
(fun h res h' ->
Ghost.reveal res == snoc (Ghost.reveal l) (sel (ccell_data tail) h) /\
sel_llist_fragment_tail res phead h' == ccell_next tail
)
#push-options "--z3rlimit 16"
let intro_llist_fragment_tail_snoc
#_ #a l phead ptail tail
=
let d = gget (vptr (ccell_data tail)) in
let l' : (l' : Ghost.erased (list a) { Cons? (Ghost.reveal l') }) = Ghost.hide (snoc (Ghost.reveal l) (Ghost.reveal d)) in
intro_vrefine (vptr (ccell_data tail)) (llist_fragment_tail_cons_data_refine l');
intro_vrefine (vptr ptail) (ccell_is_lvalue_refine a);
intro_vdep
(vptr ptail `vrefine` ccell_is_lvalue_refine a)
(vptr (ccell_data tail) `vrefine` llist_fragment_tail_cons_data_refine l')
(llist_fragment_tail_cons_lvalue_payload l');
change_equal_slprop
(llist_fragment_tail l phead)
(llist_fragment_tail (Ghost.hide (unsnoc_hd l')) phead);
intro_vdep
(llist_fragment_tail (Ghost.hide (unsnoc_hd l')) phead)
(vptr ptail `vrefine` ccell_is_lvalue_refine a `vdep` llist_fragment_tail_cons_lvalue_payload l')
(llist_fragment_tail_cons_next_payload l');
intro_vrewrite_no_norm
(llist_fragment_tail (Ghost.hide (unsnoc_hd l')) phead `vdep` llist_fragment_tail_cons_next_payload l')
(llist_fragment_tail_cons_rewrite l' (llist_fragment_tail (Ghost.hide (unsnoc_hd l')) phead));
llist_fragment_tail_eq_cons l' phead;
change_equal_slprop
(llist_fragment_tail (Ghost.hide (unsnoc_hd l')) phead `vdep` llist_fragment_tail_cons_next_payload l' `vrewrite` llist_fragment_tail_cons_rewrite l' (llist_fragment_tail (Ghost.hide (unsnoc_hd l')) phead))
(llist_fragment_tail l' phead);
let g' = gget (llist_fragment_tail l' phead) in
assert (Ghost.reveal g' == ccell_next tail);
noop ();
l'
#pop-options
[@@erasable]
noeq
type ll_unsnoc_t (a: Type) = {
ll_unsnoc_l: list a;
ll_unsnoc_ptail: ref (ccell_ptrvalue a);
ll_unsnoc_tail: ccell_lvalue a;
}
val elim_llist_fragment_tail_snoc
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
: SteelGhost (ll_unsnoc_t a) opened
(llist_fragment_tail l phead)
(fun res -> llist_fragment_tail res.ll_unsnoc_l phead `star` vptr res.ll_unsnoc_ptail `star` vptr (ccell_data res.ll_unsnoc_tail))
(fun _ -> Cons? l)
(fun h res h' ->
Cons? l /\
Ghost.reveal res.ll_unsnoc_l == unsnoc_hd l /\
sel res.ll_unsnoc_ptail h' == res.ll_unsnoc_tail /\
sel (ccell_data res.ll_unsnoc_tail) h'== unsnoc_tl l /\
sel_llist_fragment_tail res.ll_unsnoc_l phead h' == res.ll_unsnoc_ptail /\
sel_llist_fragment_tail l phead h == (ccell_next res.ll_unsnoc_tail)
)
#push-options "--z3rlimit 32"
#restart-solver
let elim_llist_fragment_tail_snoc
#_ #a l phead
=
let l0 : (l0: Ghost.erased (list a) { Cons? l0 }) = Ghost.hide (Ghost.reveal l) in
llist_fragment_tail_eq_cons l0 phead;
change_equal_slprop
(llist_fragment_tail l phead)
(llist_fragment_tail (Ghost.hide (unsnoc_hd l0)) phead `vdep` llist_fragment_tail_cons_next_payload l0 `vrewrite` llist_fragment_tail_cons_rewrite l0 (llist_fragment_tail (Ghost.hide (unsnoc_hd l0)) phead));
elim_vrewrite_no_norm
(llist_fragment_tail (Ghost.hide (unsnoc_hd l0)) phead `vdep` llist_fragment_tail_cons_next_payload l0)
(llist_fragment_tail_cons_rewrite l0 (llist_fragment_tail (Ghost.hide (unsnoc_hd l0)) phead));
let ptail = elim_vdep
(llist_fragment_tail (Ghost.hide (unsnoc_hd l0)) phead)
(llist_fragment_tail_cons_next_payload l0)
in
let ptail0 : Ghost.erased (ref (ccell_ptrvalue a)) = ptail in
change_equal_slprop
(llist_fragment_tail_cons_next_payload l0 (Ghost.reveal ptail))
(vptr (Ghost.reveal ptail0) `vrefine` ccell_is_lvalue_refine a `vdep` llist_fragment_tail_cons_lvalue_payload l0);
let tail = elim_vdep
(vptr (Ghost.reveal ptail0) `vrefine` ccell_is_lvalue_refine a)
(llist_fragment_tail_cons_lvalue_payload l0)
in
elim_vrefine (vptr (Ghost.reveal ptail0)) (ccell_is_lvalue_refine a);
let res = {
ll_unsnoc_l = unsnoc_hd l0;
ll_unsnoc_ptail = Ghost.reveal ptail0;
ll_unsnoc_tail = Ghost.reveal tail;
} in
change_equal_slprop
(vptr (Ghost.reveal ptail0))
(vptr res.ll_unsnoc_ptail);
change_equal_slprop
(llist_fragment_tail_cons_lvalue_payload l0 (Ghost.reveal tail))
(vptr (ccell_data res.ll_unsnoc_tail) `vrefine` llist_fragment_tail_cons_data_refine l0);
elim_vrefine
(vptr (ccell_data res.ll_unsnoc_tail))
(llist_fragment_tail_cons_data_refine l0);
change_equal_slprop
(llist_fragment_tail (Ghost.hide (unsnoc_hd l0)) phead)
(llist_fragment_tail res.ll_unsnoc_l phead);
res
#pop-options
let rec llist_fragment_tail_append
(#opened: _)
(#a: Type)
(phead0: ref (ccell_ptrvalue a))
(l1: Ghost.erased (list a))
(phead1: Ghost.erased (ref (ccell_ptrvalue a)))
(l2: Ghost.erased (list a))
: SteelGhost (Ghost.erased (list a)) opened
(llist_fragment_tail l1 phead0 `star` llist_fragment_tail l2 phead1)
(fun res -> llist_fragment_tail res phead0)
(fun h ->
Ghost.reveal phead1 == (sel_llist_fragment_tail l1 phead0) h
)
(fun h res h' ->
Ghost.reveal res == Ghost.reveal l1 `L.append` Ghost.reveal l2 /\
(sel_llist_fragment_tail res phead0) h' == (sel_llist_fragment_tail l2 phead1) h
)
(decreases (L.length (Ghost.reveal l2)))
=
let g1 = gget (llist_fragment_tail l1 phead0) in
assert (Ghost.reveal phead1 == Ghost.reveal g1);
if Nil? l2
then begin
L.append_l_nil (Ghost.reveal l1);
elim_llist_fragment_tail_nil l2 phead1;
l1
end else begin
let res = elim_llist_fragment_tail_snoc l2 (Ghost.reveal phead1) in
let d = gget (vptr (ccell_data res.ll_unsnoc_tail)) in
L.append_assoc (Ghost.reveal l1) (Ghost.reveal res.ll_unsnoc_l) [Ghost.reveal d];
let l3 = llist_fragment_tail_append phead0 l1 phead1 res.ll_unsnoc_l in
intro_llist_fragment_tail_snoc l3 phead0 res.ll_unsnoc_ptail res.ll_unsnoc_tail
end
let queue_tail_refine
(#a: Type)
(tail1: ref (ccell_ptrvalue a))
(tail2: ref (ccell_ptrvalue a))
(tl: normal (t_of (vptr tail2)))
: Tot prop
= ccell_ptrvalue_is_null tl == true /\ tail1 == tail2
[@@__steel_reduce__]
let queue_tail_dep2
(#a: Type)
(x: t a)
(l: Ghost.erased (list a))
(tail1: t_of (llist_fragment_tail l (cllist_head x)))
(tail2: ref (ccell_ptrvalue a))
: Tot vprop
= vptr tail2 `vrefine` queue_tail_refine tail1 tail2
[@@__steel_reduce__]
let queue_tail_dep1
(#a: Type)
(x: t a)
(l: Ghost.erased (list a))
(tail1: t_of (llist_fragment_tail l (cllist_head x)))
: Tot vprop
= vptr (cllist_tail x) `vdep` queue_tail_dep2 x l tail1
[@@__steel_reduce__; __reduce__]
let queue_tail
(#a: Type)
(x: t a)
(l: Ghost.erased (list a))
: Tot vprop
=
llist_fragment_tail l (cllist_head x) `vdep` queue_tail_dep1 x l
val intro_queue_tail
(#opened: _)
(#a: Type)
(x: t a)
(l: Ghost.erased (list a))
(tail: ref (ccell_ptrvalue a))
: SteelGhost unit opened
(llist_fragment_tail l (cllist_head x) `star` vptr (cllist_tail x) `star` vptr tail)
(fun _ -> queue_tail x l)
(fun h ->
sel_llist_fragment_tail l (cllist_head x) h == tail /\
sel (cllist_tail x) h == tail /\
ccell_ptrvalue_is_null (sel tail h)
)
(fun _ _ _ -> True)
let intro_queue_tail
x l tail
=
intro_vrefine (vptr tail) (queue_tail_refine tail tail);
intro_vdep2
(vptr (cllist_tail x))
(vptr tail `vrefine` queue_tail_refine tail tail)
tail
(queue_tail_dep2 x l tail);
intro_vdep2
(llist_fragment_tail l (cllist_head x))
(vptr (cllist_tail x) `vdep` queue_tail_dep2 x l tail)
tail
(queue_tail_dep1 x l)
val elim_queue_tail
(#opened: _)
(#a: Type)
(x: t a)
(l: Ghost.erased (list a))
: SteelGhost (Ghost.erased (ref (ccell_ptrvalue a))) opened
(queue_tail x l)
(fun tail -> llist_fragment_tail l (cllist_head x) `star` vptr (cllist_tail x) `star` vptr tail)
(fun h -> True)
(fun _ tail h ->
sel_llist_fragment_tail l (cllist_head x) h == Ghost.reveal tail /\
sel (cllist_tail x) h == Ghost.reveal tail /\
ccell_ptrvalue_is_null (h (vptr tail))
)
let elim_queue_tail
#_ #a x l
=
let tail0 = elim_vdep
(llist_fragment_tail l (cllist_head x))
(queue_tail_dep1 x l)
in
let tail : Ghost.erased (ref (ccell_ptrvalue a)) = tail0 in
change_equal_slprop
(queue_tail_dep1 x l (Ghost.reveal tail0))
(vptr (cllist_tail x) `vdep` queue_tail_dep2 x l tail0);
let tail2 = elim_vdep
(vptr (cllist_tail x))
(queue_tail_dep2 x l tail0)
in
let tail3 : Ghost.erased (ref (ccell_ptrvalue a)) = tail2 in
change_equal_slprop
(queue_tail_dep2 x l tail0 (Ghost.reveal tail2))
(vptr tail3 `vrefine` queue_tail_refine tail0 tail3);
elim_vrefine (vptr tail3) (queue_tail_refine tail0 tail3);
change_equal_slprop
(vptr tail3)
(vptr tail);
tail
(* view from the head *)
let llist_fragment_head_data_refine
(#a: Type)
(d: a)
(c: vcell a)
: Tot prop
= c.vcell_data == d
let llist_fragment_head_payload
(#a: Type)
(head: ccell_ptrvalue a)
(d: a)
(llist_fragment_head: (ref (ccell_ptrvalue a) -> ccell_ptrvalue a -> Tot vprop))
(x: t_of (ccell_is_lvalue head `star` (ccell head `vrefine` llist_fragment_head_data_refine d)))
: Tot vprop
=
llist_fragment_head (ccell_next (fst x)) (snd x).vcell_next
let rec llist_fragment_head (#a: Type) (l: Ghost.erased (list a)) (phead: ref (ccell_ptrvalue a)) (head: ccell_ptrvalue a) : Tot vprop
(decreases (Ghost.reveal l))
=
if Nil? l
then vconst (phead, head)
else
vbind
(ccell_is_lvalue head `star` (ccell head `vrefine` llist_fragment_head_data_refine (L.hd (Ghost.reveal l))))
(ref (ccell_ptrvalue a) & ccell_ptrvalue a)
(llist_fragment_head_payload head (L.hd (Ghost.reveal l)) (llist_fragment_head (L.tl (Ghost.reveal l))))
let t_of_llist_fragment_head
(#a: Type) (l: Ghost.erased (list a)) (phead: ref (ccell_ptrvalue a)) (head: ccell_ptrvalue a)
: Lemma
(t_of (llist_fragment_head l phead head) == ref (ccell_ptrvalue a) & ccell_ptrvalue a)
= ()
unfold
let sel_llist_fragment_head
(#a:Type) (#p:vprop)
(l: Ghost.erased (list a)) (phead: ref (ccell_ptrvalue a)) (head: ccell_ptrvalue a)
(h: rmem p { FStar.Tactics.with_tactic selector_tactic (can_be_split p (llist_fragment_head l phead head) /\ True) })
: GTot (ref (ccell_ptrvalue a) & ccell_ptrvalue a)
=
coerce (h (llist_fragment_head l phead head)) (ref (ccell_ptrvalue a) & ccell_ptrvalue a)
val intro_llist_fragment_head_nil
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
(head: ccell_ptrvalue a)
: SteelGhost unit opened
emp
(fun _ -> llist_fragment_head l phead head)
(fun _ -> Nil? l)
(fun _ _ h' -> sel_llist_fragment_head l phead head h' == (phead, head))
let intro_llist_fragment_head_nil
l phead head
=
intro_vconst (phead, head);
change_equal_slprop
(vconst (phead, head))
(llist_fragment_head l phead head)
val elim_llist_fragment_head_nil
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
(head: ccell_ptrvalue a)
: SteelGhost unit opened
(llist_fragment_head l phead head)
(fun _ -> emp)
(fun _ -> Nil? l)
(fun h _ _ -> sel_llist_fragment_head l phead head h == (phead, head))
let elim_llist_fragment_head_nil
l phead head
=
change_equal_slprop
(llist_fragment_head l phead head)
(vconst (phead, head));
elim_vconst (phead, head)
let llist_fragment_head_eq_cons
(#a: Type) (l: Ghost.erased (list a)) (phead: ref (ccell_ptrvalue a)) (head: ccell_ptrvalue a)
: Lemma
(requires (Cons? (Ghost.reveal l)))
(ensures (
llist_fragment_head l phead head ==
vbind
(ccell_is_lvalue head `star` (ccell head `vrefine` llist_fragment_head_data_refine (L.hd (Ghost.reveal l))))
(ref (ccell_ptrvalue a) & ccell_ptrvalue a)
(llist_fragment_head_payload head (L.hd (Ghost.reveal l)) (llist_fragment_head (L.tl (Ghost.reveal l))))
))
= assert_norm
(llist_fragment_head l phead head == (
if Nil? l
then vconst (phead, head)
else
vbind
(ccell_is_lvalue head `star` (ccell head `vrefine` llist_fragment_head_data_refine (L.hd (Ghost.reveal l))))
(ref (ccell_ptrvalue a) & ccell_ptrvalue a)
(llist_fragment_head_payload head (L.hd (Ghost.reveal l)) (llist_fragment_head (L.tl (Ghost.reveal l))))
))
val intro_llist_fragment_head_cons
(#opened: _)
(#a: Type) (phead: ref (ccell_ptrvalue a)) (head: ccell_lvalue a) (next: (ccell_ptrvalue a)) (tl: Ghost.erased (list a))
: SteelGhost (Ghost.erased (list a)) opened
(ccell head `star` llist_fragment_head tl (ccell_next head) next)
(fun res -> llist_fragment_head res phead head)
(fun h -> (h (ccell head)).vcell_next == next)
(fun h res h' ->
Ghost.reveal res == (h (ccell head)).vcell_data :: Ghost.reveal tl /\
h' (llist_fragment_head res phead head) == h (llist_fragment_head tl (ccell_next head) next)
)
let intro_llist_fragment_head_cons
#_ #a phead head next tl
=
let vc = gget (ccell head) in
let l' : (l' : Ghost.erased (list a) { Cons? l' }) = Ghost.hide (vc.vcell_data :: tl) in
intro_ccell_is_lvalue head;
intro_vrefine (ccell head) (llist_fragment_head_data_refine (L.hd l'));
intro_vbind
(ccell_is_lvalue head `star` (ccell head `vrefine` llist_fragment_head_data_refine (L.hd l')))
(llist_fragment_head tl (ccell_next head) next)
(ref (ccell_ptrvalue a) & ccell_ptrvalue a)
(llist_fragment_head_payload head (L.hd l') (llist_fragment_head (L.tl l')));
llist_fragment_head_eq_cons l' phead head;
change_equal_slprop
(vbind
(ccell_is_lvalue head `star` (ccell head `vrefine` llist_fragment_head_data_refine (L.hd l')))
(ref (ccell_ptrvalue a) & ccell_ptrvalue a)
(llist_fragment_head_payload head (L.hd l') (llist_fragment_head (L.tl l'))))
(llist_fragment_head l' phead head);
l'
[@@erasable]
noeq
type ll_uncons_t
(a: Type)
= {
ll_uncons_pnext: Ghost.erased (ref (ccell_ptrvalue a));
ll_uncons_next: Ghost.erased (ccell_ptrvalue a);
ll_uncons_tl: Ghost.erased (list a);
}
val elim_llist_fragment_head_cons
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
(head: ccell_ptrvalue a)
: SteelGhost (ll_uncons_t a) opened
(llist_fragment_head l phead head)
(fun res -> ccell head `star` llist_fragment_head res.ll_uncons_tl res.ll_uncons_pnext res.ll_uncons_next)
(fun _ -> Cons? (Ghost.reveal l))
(fun h res h' ->
ccell_ptrvalue_is_null head == false /\
Ghost.reveal l == (h' (ccell head)).vcell_data :: Ghost.reveal res.ll_uncons_tl /\
Ghost.reveal res.ll_uncons_pnext == ccell_next head /\
Ghost.reveal res.ll_uncons_next == (h' (ccell head)).vcell_next /\
h' (llist_fragment_head res.ll_uncons_tl res.ll_uncons_pnext res.ll_uncons_next) == h (llist_fragment_head l phead head)
)
let elim_llist_fragment_head_cons
#_ #a l0 phead head
=
let l : (l : Ghost.erased (list a) { Cons? l }) = l0 in
change_equal_slprop
(llist_fragment_head l0 phead head)
(llist_fragment_head l phead head);
llist_fragment_head_eq_cons l phead head;
change_equal_slprop
(llist_fragment_head l phead head)
(vbind
(ccell_is_lvalue head `star` (ccell head `vrefine` llist_fragment_head_data_refine (L.hd l)))
(ref (ccell_ptrvalue a) & ccell_ptrvalue a)
(llist_fragment_head_payload head (L.hd l) (llist_fragment_head (L.tl l))));
let x = elim_vbind
(ccell_is_lvalue head `star` (ccell head `vrefine` llist_fragment_head_data_refine (L.hd l)))
(ref (ccell_ptrvalue a) & ccell_ptrvalue a)
(llist_fragment_head_payload head (L.hd l) (llist_fragment_head (L.tl l)))
in
let head2 = gget (ccell_is_lvalue head) in
elim_ccell_is_lvalue head;
elim_vrefine (ccell head) (llist_fragment_head_data_refine (L.hd l));
let vhead2 = gget (ccell head) in
let res = {
ll_uncons_pnext = ccell_next head2;
ll_uncons_next = vhead2.vcell_next;
ll_uncons_tl = L.tl l;
} in
change_equal_slprop
(llist_fragment_head_payload head (L.hd l) (llist_fragment_head (L.tl l)) (Ghost.reveal x))
(llist_fragment_head res.ll_uncons_tl res.ll_uncons_pnext res.ll_uncons_next);
res
let rec llist_fragment_head_append
(#opened: _)
(#a: Type)
(l1: Ghost.erased (list a))
(phead1: ref (ccell_ptrvalue a))
(head1: ccell_ptrvalue a)
(l2: Ghost.erased (list a))
(phead2: ref (ccell_ptrvalue a))
(head2: ccell_ptrvalue a)
: SteelGhost (Ghost.erased (list a)) opened
(llist_fragment_head l1 phead1 head1 `star` llist_fragment_head l2 phead2 head2)
(fun l -> llist_fragment_head l phead1 head1)
(fun h -> sel_llist_fragment_head l1 phead1 head1 h == (Ghost.reveal phead2, Ghost.reveal head2))
(fun h l h' ->
Ghost.reveal l == Ghost.reveal l1 `L.append` Ghost.reveal l2 /\
h' (llist_fragment_head l phead1 head1) == h (llist_fragment_head l2 phead2 head2)
)
(decreases (Ghost.reveal l1))
=
if Nil? l1
then begin
elim_llist_fragment_head_nil l1 phead1 head1;
change_equal_slprop
(llist_fragment_head l2 phead2 head2)
(llist_fragment_head l2 phead1 head1);
l2
end else begin
let u = elim_llist_fragment_head_cons l1 phead1 head1 in
let head1' : Ghost.erased (ccell_lvalue a) = head1 in
let l3 = llist_fragment_head_append u.ll_uncons_tl u.ll_uncons_pnext u.ll_uncons_next l2 phead2 head2 in
change_equal_slprop
(llist_fragment_head l3 u.ll_uncons_pnext u.ll_uncons_next)
(llist_fragment_head l3 (ccell_next head1') u.ll_uncons_next);
change_equal_slprop
(ccell head1)
(ccell head1');
let l4 = intro_llist_fragment_head_cons phead1 head1' u.ll_uncons_next l3 in
change_equal_slprop
(llist_fragment_head l4 phead1 head1')
(llist_fragment_head l4 phead1 head1);
l4
end | {
"checked_file": "/",
"dependencies": [
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"CQueue.LList.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.fst"
} | [
{
"abbrev": false,
"full_module": "CQueue.LList",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
l: FStar.Ghost.erased (Prims.list a) ->
phead: Steel.Reference.ref (CQueue.Cell.ccell_ptrvalue a) ->
head: CQueue.Cell.ccell_ptrvalue a
-> Steel.Effect.Atomic.SteelGhost
(FStar.Ghost.erased (Steel.Reference.ref (CQueue.Cell.ccell_ptrvalue a))) | Steel.Effect.Atomic.SteelGhost | [
""
] | [] | [
"Steel.Memory.inames",
"FStar.Ghost.erased",
"Prims.list",
"Steel.Reference.ref",
"CQueue.Cell.ccell_ptrvalue",
"Prims.uu___is_Nil",
"FStar.Ghost.reveal",
"Prims.unit",
"Steel.Effect.Atomic.change_equal_slprop",
"Steel.Reference.vptr",
"CQueue.intro_llist_fragment_tail_nil",
"CQueue.elim_llist_fragment_head_nil",
"Prims._assert",
"CQueue.op_Equals_Equals",
"Steel.Effect.Common.t_of",
"Steel.Effect.Common.VUnit",
"Steel.Reference.vptr'",
"Steel.FractionalPermission.full_perm",
"Steel.Effect.Atomic.gget",
"FStar.Ghost.hide",
"Prims.bool",
"CQueue.llist_fragment_tail",
"CQueue.llist_fragment_tail_append",
"CQueue.__proj__Mkll_uncons_t__item__ll_uncons_pnext",
"CQueue.__proj__Mkll_uncons_t__item__ll_uncons_tl",
"CQueue.llist_fragment_head_to_tail",
"CQueue.__proj__Mkll_uncons_t__item__ll_uncons_next",
"CQueue.intro_llist_fragment_tail_snoc",
"Prims.Nil",
"CQueue.Cell.ccell_next",
"CQueue.Cell.ccell_lvalue",
"CQueue.Cell.elim_ccell_ghost",
"CQueue.ll_uncons_t",
"CQueue.elim_llist_fragment_head_cons",
"Steel.Effect.Common.star",
"CQueue.llist_fragment_head",
"Steel.Effect.Common.vprop",
"Steel.Effect.Common.rmem",
"Prims.l_and",
"FStar.Pervasives.Native.fst",
"CQueue.sel_llist_fragment_tail",
"FStar.Pervasives.Native.snd",
"FStar.Pervasives.Native.tuple2",
"CQueue.sel_llist_fragment_head"
] | [
"recursion"
] | false | true | false | false | false | let rec llist_fragment_head_to_tail
(#opened: _)
(#a: Type)
(l: Ghost.erased (list a))
(phead: ref (ccell_ptrvalue a))
(head: ccell_ptrvalue a)
: SteelGhost (Ghost.erased (ref (ccell_ptrvalue a)))
opened
((vptr phead) `star` (llist_fragment_head l phead head))
(fun res -> (llist_fragment_tail l phead) `star` (vptr res))
(fun h -> h (vptr phead) == head)
(fun h res h' ->
let v = sel_llist_fragment_head l phead head h in
fst v == Ghost.reveal res /\ fst v == sel_llist_fragment_tail l phead h' /\
snd v == h' (vptr res))
(decreases (L.length (Ghost.reveal l))) =
| if Nil? l
then
let ptail = Ghost.hide phead in
let gh = gget (vptr phead) in
assert (Ghost.reveal gh == head);
elim_llist_fragment_head_nil l phead head;
intro_llist_fragment_tail_nil l phead;
change_equal_slprop (vptr phead) (vptr ptail);
ptail
else
(intro_llist_fragment_tail_nil [] phead;
change_equal_slprop (vptr phead) (vptr (Ghost.reveal (Ghost.hide phead)));
let uc = elim_llist_fragment_head_cons l phead head in
let head' = elim_ccell_ghost head in
change_equal_slprop (vptr (ccell_next head')) (vptr uc.ll_uncons_pnext);
let lc = intro_llist_fragment_tail_snoc [] phead phead head' in
let ptail = llist_fragment_head_to_tail uc.ll_uncons_tl uc.ll_uncons_pnext uc.ll_uncons_next in
let l' = llist_fragment_tail_append phead lc uc.ll_uncons_pnext uc.ll_uncons_tl in
change_equal_slprop (llist_fragment_tail l' phead) (llist_fragment_tail l phead);
ptail) | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.hinv | val hinv : Type | let hinv = HS.mem ^-> prop | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 26,
"end_line": 20,
"start_col": 0,
"start_line": 20
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type | Prims.Tot | [
"total"
] | [] | [
"FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater",
"FStar.Monotonic.HyperStack.mem",
"Prims.prop"
] | [] | false | false | false | true | true | let hinv =
| HS.mem ^-> prop | false |
|
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.mem_inv | val mem_inv : Type | let mem_inv = liveness_inv | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 27,
"end_line": 24,
"start_col": 0,
"start_line": 24
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.liveness_inv"
] | [] | false | false | false | true | true | let mem_inv =
| liveness_inv | false |
|
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.inv_implies | val inv_implies (inv0 inv1: slice_inv) : Tot prop | val inv_implies (inv0 inv1: slice_inv) : Tot prop | let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 21,
"end_line": 28,
"start_col": 0,
"start_line": 26
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | inv0: EverParse3d.Actions.Base.slice_inv -> inv1: EverParse3d.Actions.Base.slice_inv -> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.slice_inv",
"Prims.l_Forall",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_imp",
"Prims.prop"
] | [] | false | false | false | true | true | let inv_implies (inv0 inv1: slice_inv) =
| forall h. inv0 h ==> inv1 h | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.slice_inv | val slice_inv : Type u#1 | val slice_inv : Type u#1 | let slice_inv = mem_inv | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 23,
"end_line": 25,
"start_col": 0,
"start_line": 25
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.mem_inv"
] | [] | false | false | false | true | true | let slice_inv =
| mem_inv | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.eloc | val eloc : Type0 | val eloc : Type0 | let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l }) | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 99,
"end_line": 31,
"start_col": 0,
"start_line": 31
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.erased",
"LowStar.Monotonic.Buffer.loc",
"LowStar.Monotonic.Buffer.loc_includes",
"LowStar.Monotonic.Buffer.address_liveness_insensitive_locs",
"FStar.Ghost.reveal"
] | [] | false | false | false | true | true | let eloc =
| (l: FStar.Ghost.erased B.loc {B.address_liveness_insensitive_locs `B.loc_includes` l}) | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.eloc_includes | val eloc_includes (l1 l2: eloc) : Tot prop | val eloc_includes (l1 l2: eloc) : Tot prop | let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 61,
"end_line": 34,
"start_col": 0,
"start_line": 34
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l1: EverParse3d.Actions.Base.eloc -> l2: EverParse3d.Actions.Base.eloc -> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.eloc",
"Prims.l_and",
"LowStar.Monotonic.Buffer.loc_includes",
"FStar.Ghost.reveal",
"LowStar.Monotonic.Buffer.loc",
"Prims.l_True",
"Prims.prop"
] | [] | false | false | false | true | true | let eloc_includes (l1 l2: eloc) =
| B.loc_includes l1 l2 /\ True | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.eloc_disjoint | val eloc_disjoint (l1 l2: eloc) : Tot prop | val eloc_disjoint (l1 l2: eloc) : Tot prop | let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 61,
"end_line": 35,
"start_col": 0,
"start_line": 35
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l1: EverParse3d.Actions.Base.eloc -> l2: EverParse3d.Actions.Base.eloc -> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.eloc",
"Prims.l_and",
"LowStar.Monotonic.Buffer.loc_disjoint",
"FStar.Ghost.reveal",
"LowStar.Monotonic.Buffer.loc",
"Prims.l_True",
"Prims.prop"
] | [] | false | false | false | true | true | let eloc_disjoint (l1 l2: eloc) =
| B.loc_disjoint l1 l2 /\ True | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.fevalh | val fevalh (h: mem) (f: felem) : GTot P.elem | val fevalh (h: mem) (f: felem) : GTot P.elem | let fevalh (h:mem) (f:felem) : GTot P.elem = (as_nat h f) % P.prime | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 67,
"end_line": 41,
"start_col": 0,
"start_line": 41
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul
let felem = lbuffer uint64 4ul
let felem2 = lbuffer uint64 8ul
noextract
let as_nat (h:mem) (e:felem) : GTot nat =
let s = as_seq h e in
let s0 = s.[0] in
let s1 = s.[1] in
let s2 = s.[2] in
let s3 = s.[3] in
S.as_nat4 (s0, s1, s2, s3) | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: FStar.Monotonic.HyperStack.mem -> f: Hacl.Impl.Curve25519.Field64.felem
-> Prims.GTot Spec.Curve25519.elem | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Monotonic.HyperStack.mem",
"Hacl.Impl.Curve25519.Field64.felem",
"Prims.op_Modulus",
"Hacl.Impl.Curve25519.Field64.as_nat",
"Spec.Curve25519.prime",
"Spec.Curve25519.elem"
] | [] | false | false | false | false | false | let fevalh (h: mem) (f: felem) : GTot P.elem =
| (as_nat h f) % P.prime | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.as_nat | val as_nat (h: mem) (e: felem) : GTot nat | val as_nat (h: mem) (e: felem) : GTot nat | let as_nat (h:mem) (e:felem) : GTot nat =
let s = as_seq h e in
let s0 = s.[0] in
let s1 = s.[1] in
let s2 = s.[2] in
let s3 = s.[3] in
S.as_nat4 (s0, s1, s2, s3) | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 28,
"end_line": 38,
"start_col": 0,
"start_line": 32
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul
let felem = lbuffer uint64 4ul
let felem2 = lbuffer uint64 8ul | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: FStar.Monotonic.HyperStack.mem -> e: Hacl.Impl.Curve25519.Field64.felem -> Prims.GTot Prims.nat | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Monotonic.HyperStack.mem",
"Hacl.Impl.Curve25519.Field64.felem",
"Hacl.Spec.Curve25519.Field64.Definition.as_nat4",
"FStar.Pervasives.Native.Mktuple4",
"Lib.IntTypes.uint64",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.eq2",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Sequence.op_String_Access",
"FStar.UInt32.__uint_to_t",
"Lib.Sequence.lseq",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Prims.nat"
] | [] | false | false | false | false | false | let as_nat (h: mem) (e: felem) : GTot nat =
| let s = as_seq h e in
let s0 = s.[ 0 ] in
let s1 = s.[ 1 ] in
let s2 = s.[ 2 ] in
let s3 = s.[ 3 ] in
S.as_nat4 (s0, s1, s2, s3) | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.disjointness_pre | val disjointness_pre : Type u#1 | val disjointness_pre : Type u#1 | let disjointness_pre = prop | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 27,
"end_line": 50,
"start_col": 0,
"start_line": 50
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type | Prims.Tot | [
"total"
] | [] | [
"Prims.prop"
] | [] | false | false | false | true | true | let disjointness_pre =
| prop | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.disjointness_trivial | val disjointness_trivial : disjointness_pre | val disjointness_trivial : disjointness_pre | let disjointness_trivial = True | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 31,
"end_line": 51,
"start_col": 0,
"start_line": 51
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Actions.Base.disjointness_pre | Prims.Tot | [
"total"
] | [] | [
"Prims.l_True"
] | [] | false | false | false | true | false | let disjointness_trivial =
| True | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.disjoint | val disjoint (l1 l2:eloc) : disjointness_pre | val disjoint (l1 l2:eloc) : disjointness_pre | let disjoint l1 l2 = eloc_disjoint l1 l2 | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 40,
"end_line": 52,
"start_col": 0,
"start_line": 52
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l1: EverParse3d.Actions.Base.eloc -> l2: EverParse3d.Actions.Base.eloc
-> EverParse3d.Actions.Base.disjointness_pre | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.eloc",
"EverParse3d.Actions.Base.eloc_disjoint",
"EverParse3d.Actions.Base.disjointness_pre"
] | [] | false | false | false | true | false | let disjoint l1 l2 =
| eloc_disjoint l1 l2 | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.set_zero | val set_zero: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == 0) | val set_zero: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == 0) | let set_zero f =
f.(0ul) <- u64 0;
f.(1ul) <- u64 0;
f.(2ul) <- u64 0;
f.(3ul) <- u64 0 | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 18,
"end_line": 149,
"start_col": 0,
"start_line": 145
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul
let felem = lbuffer uint64 4ul
let felem2 = lbuffer uint64 8ul
noextract
let as_nat (h:mem) (e:felem) : GTot nat =
let s = as_seq h e in
let s0 = s.[0] in
let s1 = s.[1] in
let s2 = s.[2] in
let s3 = s.[3] in
S.as_nat4 (s0, s1, s2, s3)
noextract
let fevalh (h:mem) (f:felem) : GTot P.elem = (as_nat h f) % P.prime
inline_for_extraction noextract
val create_felem: unit ->
StackInline felem
(requires fun _ -> True)
(ensures fun h0 f h1 ->
stack_allocated f h0 h1 (Seq.create 4 (u64 0)) /\
as_nat h1 f == 0)
let create_felem () = create 4ul (u64 0)
inline_for_extraction noextract
val load_felem:
f:felem
-> u64s:lbuffer uint64 4ul ->
Stack unit
(requires fun h ->
live h u64s /\ live h f /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s))
let load_felem f u64s =
let h0 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h0 u64s);
f.(0ul) <- u64s.(0ul);
f.(1ul) <- u64s.(1ul);
f.(2ul) <- u64s.(2ul);
f.(3ul) <- u64s.(3ul)
val carry_pass_store: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_seq h1 f == SC.carry_pass_store (as_seq h0 f))
[@ Meta.Attribute.inline_ ]
let carry_pass_store f =
let f3 = f.(3ul) in
let top_bit = f3 >>. 63ul in
f.(3ul) <- f3 &. u64 0x7fffffffffffffff;
let h0 = ST.get () in
let carry = add1 f f (u64 19 *! top_bit) in
let h1 = ST.get () in
assert (as_nat h1 f + v carry * pow2 256 == as_nat h0 f + 19 * v top_bit);
S.bn_v_is_as_nat (as_seq h1 f);
S.bn_v_is_as_nat (as_seq h0 f);
let cr = Ghost.hide (Hacl.Spec.Curve25519.Field64.Core.add1 (as_seq h0 f) (u64 19 *! top_bit)) in
SD.bn_eval_bound (snd cr) 4;
assert (v (fst cr) == v carry /\ SD.bn_v (snd cr) == as_nat h1 f);
SD.bn_eval_inj 4 (snd cr) (as_seq h1 f);
()
val store_felem:
u64s:lbuffer uint64 4ul
-> f:felem ->
Stack unit
(requires fun h ->
live h f /\ live h u64s /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc u64s |+| loc f) h0 h1 /\
as_seq h1 u64s == BSeq.nat_to_intseq_le 4 (fevalh h0 f))
[@ Meta.Attribute.inline_ ]
let store_felem u64s f =
let h0 = ST.get () in
carry_pass_store f;
let h1 = ST.get () in
SC.lemma_carry_pass_store_first (as_seq h0 f);
carry_pass_store f;
let h2 = ST.get () in
SC.lemma_carry_pass_store_second (as_seq h1 f);
let f0 = f.(0ul) in
let f1 = f.(1ul) in
let f2 = f.(2ul) in
let f3 = f.(3ul) in
S.bn_v_is_as_nat (as_seq h0 f);
S.bn_v_is_as_nat (as_seq h2 f);
let (o0, o1, o2, o3) = SC.subtract_p4 (f0, f1, f2, f3) in
assert (S.as_nat4 (o0, o1, o2, o3) < P.prime);
assert (S.as_nat4 (o0, o1, o2, o3) == (as_nat h2 f) % P.prime);
u64s.(0ul) <- o0;
u64s.(1ul) <- o1;
u64s.(2ul) <- o2;
u64s.(3ul) <- o3;
let h3 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h3 u64s);
BSeq.lemma_nat_from_to_intseq_le_preserves_value 4 (as_seq h3 u64s)
inline_for_extraction noextract
val set_zero: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == 0) | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Hacl.Impl.Curve25519.Field64.felem -> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.Curve25519.Field64.felem",
"Lib.Buffer.op_Array_Assignment",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.u64",
"Prims.unit"
] | [] | false | true | false | false | false | let set_zero f =
| f.(0ul) <- u64 0;
f.(1ul) <- u64 0;
f.(2ul) <- u64 0;
f.(3ul) <- u64 0 | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.imp_disjointness | val imp_disjointness (d1 d2:disjointness_pre) : prop | val imp_disjointness (d1 d2:disjointness_pre) : prop | let imp_disjointness p1 p2 = p1 ==> p2 | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 38,
"end_line": 54,
"start_col": 0,
"start_line": 54
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | d1: EverParse3d.Actions.Base.disjointness_pre -> d2: EverParse3d.Actions.Base.disjointness_pre
-> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.disjointness_pre",
"Prims.l_imp",
"Prims.prop"
] | [] | false | false | false | true | true | let imp_disjointness p1 p2 =
| p1 ==> p2 | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.conj_disjointness | val conj_disjointness (d0 d1:disjointness_pre) : disjointness_pre | val conj_disjointness (d0 d1:disjointness_pre) : disjointness_pre | let conj_disjointness p1 p2 = p1 /\ p2 | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 38,
"end_line": 53,
"start_col": 0,
"start_line": 53
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | d0: EverParse3d.Actions.Base.disjointness_pre -> d1: EverParse3d.Actions.Base.disjointness_pre
-> EverParse3d.Actions.Base.disjointness_pre | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.disjointness_pre",
"Prims.l_and"
] | [] | false | false | false | true | false | let conj_disjointness p1 p2 =
| p1 /\ p2 | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.bpointer | val bpointer (a: Type0) : Tot Type0 | val bpointer (a: Type0) : Tot Type0 | let bpointer a = B.pointer a | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 28,
"end_line": 112,
"start_col": 0,
"start_line": 112
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2
let imp_disjointness p1 p2 = p1 ==> p2
let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none)
(disjointness_trivial)
let disjoint_none_l l =
FStar.PropositionalExtensionality.apply
(disjoint eloc_none l)
(disjointness_trivial)
let conj_disjointness_trivial_left_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d
let conj_disjointness_trivial_right_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (d `conj_disjointness` disjointness_trivial) d
let imp_disjointness_refl (d:disjointness_pre)
= ()
let index_equations ()
= introduce forall d. _
with conj_inv_true_left_unit d;
introduce forall d. _
with conj_inv_true_right_unit d;
introduce forall l. _
with eloc_union_none_right_unit l;
introduce forall l. _
with eloc_union_none_left_unit l;
introduce forall l. _
with disjoint_none_r l;
introduce forall l. _
with disjoint_none_l l;
introduce forall d. _
with conj_disjointness_trivial_left_unit d;
introduce forall d. _
with conj_disjointness_trivial_right_unit d;
introduce forall d. _
with imp_disjointness_refl d;
introduce forall i. _
with inv_implies_refl i;
introduce forall i. _
with inv_implies_true i;
introduce forall i0 i1 i2.
(i0 `inv_implies` i1 /\
i0 `inv_implies` i2) ==>
(i0 `inv_implies` (i1 `conj_inv` i2))
with introduce _ ==> _
with _ . inv_implies_conj i0 i1 i2 () ();
introduce forall l. _
with eloc_includes_none l;
introduce forall l0 l1 l2. (l0 `eloc_includes` l1 /\
l0 `eloc_includes` l2) ==>
(l0 `eloc_includes` (l1 `eloc_union` l2))
with introduce _ ==> _
with _ . eloc_includes_union l0 l1 l2 () ();
introduce forall l. _
with eloc_includes_refl l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type0 -> Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.pointer"
] | [] | false | false | false | true | true | let bpointer a =
| B.pointer a | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.load_felem | val load_felem:
f:felem
-> u64s:lbuffer uint64 4ul ->
Stack unit
(requires fun h ->
live h u64s /\ live h f /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s)) | val load_felem:
f:felem
-> u64s:lbuffer uint64 4ul ->
Stack unit
(requires fun h ->
live h u64s /\ live h f /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s)) | let load_felem f u64s =
let h0 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h0 u64s);
f.(0ul) <- u64s.(0ul);
f.(1ul) <- u64s.(1ul);
f.(2ul) <- u64s.(2ul);
f.(3ul) <- u64s.(3ul) | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 72,
"start_col": 0,
"start_line": 66
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul
let felem = lbuffer uint64 4ul
let felem2 = lbuffer uint64 8ul
noextract
let as_nat (h:mem) (e:felem) : GTot nat =
let s = as_seq h e in
let s0 = s.[0] in
let s1 = s.[1] in
let s2 = s.[2] in
let s3 = s.[3] in
S.as_nat4 (s0, s1, s2, s3)
noextract
let fevalh (h:mem) (f:felem) : GTot P.elem = (as_nat h f) % P.prime
inline_for_extraction noextract
val create_felem: unit ->
StackInline felem
(requires fun _ -> True)
(ensures fun h0 f h1 ->
stack_allocated f h0 h1 (Seq.create 4 (u64 0)) /\
as_nat h1 f == 0)
let create_felem () = create 4ul (u64 0)
inline_for_extraction noextract
val load_felem:
f:felem
-> u64s:lbuffer uint64 4ul ->
Stack unit
(requires fun h ->
live h u64s /\ live h f /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s)) | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Hacl.Impl.Curve25519.Field64.felem -> u64s: Lib.Buffer.lbuffer Lib.IntTypes.uint64 4ul
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.Curve25519.Field64.felem",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Lib.Buffer.op_Array_Assignment",
"Prims.unit",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.MUT",
"Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4",
"Lib.Buffer.as_seq",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get"
] | [] | false | true | false | false | false | let load_felem f u64s =
| let h0 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h0 u64s);
f.(0ul) <- u64s.(0ul);
f.(1ul) <- u64s.(1ul);
f.(2ul) <- u64s.(2ul);
f.(3ul) <- u64s.(3ul) | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.create_felem | val create_felem: unit ->
StackInline felem
(requires fun _ -> True)
(ensures fun h0 f h1 ->
stack_allocated f h0 h1 (Seq.create 4 (u64 0)) /\
as_nat h1 f == 0) | val create_felem: unit ->
StackInline felem
(requires fun _ -> True)
(ensures fun h0 f h1 ->
stack_allocated f h0 h1 (Seq.create 4 (u64 0)) /\
as_nat h1 f == 0) | let create_felem () = create 4ul (u64 0) | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 40,
"end_line": 52,
"start_col": 0,
"start_line": 52
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul
let felem = lbuffer uint64 4ul
let felem2 = lbuffer uint64 8ul
noextract
let as_nat (h:mem) (e:felem) : GTot nat =
let s = as_seq h e in
let s0 = s.[0] in
let s1 = s.[1] in
let s2 = s.[2] in
let s3 = s.[3] in
S.as_nat4 (s0, s1, s2, s3)
noextract
let fevalh (h:mem) (f:felem) : GTot P.elem = (as_nat h f) % P.prime
inline_for_extraction noextract
val create_felem: unit ->
StackInline felem
(requires fun _ -> True)
(ensures fun h0 f h1 ->
stack_allocated f h0 h1 (Seq.create 4 (u64 0)) /\
as_nat h1 f == 0) | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> FStar.HyperStack.ST.StackInline Hacl.Impl.Curve25519.Field64.felem | FStar.HyperStack.ST.StackInline | [] | [] | [
"Prims.unit",
"Lib.Buffer.create",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.u64",
"Lib.Buffer.lbuffer",
"Hacl.Impl.Curve25519.Field64.felem"
] | [] | false | true | false | false | false | let create_felem () =
| create 4ul (u64 0) | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.set_one | val set_one: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == 1) | val set_one: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == 1) | let set_one f =
f.(0ul) <- u64 1;
f.(1ul) <- u64 0;
f.(2ul) <- u64 0;
f.(3ul) <- u64 0 | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 18,
"end_line": 164,
"start_col": 0,
"start_line": 160
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul
let felem = lbuffer uint64 4ul
let felem2 = lbuffer uint64 8ul
noextract
let as_nat (h:mem) (e:felem) : GTot nat =
let s = as_seq h e in
let s0 = s.[0] in
let s1 = s.[1] in
let s2 = s.[2] in
let s3 = s.[3] in
S.as_nat4 (s0, s1, s2, s3)
noextract
let fevalh (h:mem) (f:felem) : GTot P.elem = (as_nat h f) % P.prime
inline_for_extraction noextract
val create_felem: unit ->
StackInline felem
(requires fun _ -> True)
(ensures fun h0 f h1 ->
stack_allocated f h0 h1 (Seq.create 4 (u64 0)) /\
as_nat h1 f == 0)
let create_felem () = create 4ul (u64 0)
inline_for_extraction noextract
val load_felem:
f:felem
-> u64s:lbuffer uint64 4ul ->
Stack unit
(requires fun h ->
live h u64s /\ live h f /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s))
let load_felem f u64s =
let h0 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h0 u64s);
f.(0ul) <- u64s.(0ul);
f.(1ul) <- u64s.(1ul);
f.(2ul) <- u64s.(2ul);
f.(3ul) <- u64s.(3ul)
val carry_pass_store: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_seq h1 f == SC.carry_pass_store (as_seq h0 f))
[@ Meta.Attribute.inline_ ]
let carry_pass_store f =
let f3 = f.(3ul) in
let top_bit = f3 >>. 63ul in
f.(3ul) <- f3 &. u64 0x7fffffffffffffff;
let h0 = ST.get () in
let carry = add1 f f (u64 19 *! top_bit) in
let h1 = ST.get () in
assert (as_nat h1 f + v carry * pow2 256 == as_nat h0 f + 19 * v top_bit);
S.bn_v_is_as_nat (as_seq h1 f);
S.bn_v_is_as_nat (as_seq h0 f);
let cr = Ghost.hide (Hacl.Spec.Curve25519.Field64.Core.add1 (as_seq h0 f) (u64 19 *! top_bit)) in
SD.bn_eval_bound (snd cr) 4;
assert (v (fst cr) == v carry /\ SD.bn_v (snd cr) == as_nat h1 f);
SD.bn_eval_inj 4 (snd cr) (as_seq h1 f);
()
val store_felem:
u64s:lbuffer uint64 4ul
-> f:felem ->
Stack unit
(requires fun h ->
live h f /\ live h u64s /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc u64s |+| loc f) h0 h1 /\
as_seq h1 u64s == BSeq.nat_to_intseq_le 4 (fevalh h0 f))
[@ Meta.Attribute.inline_ ]
let store_felem u64s f =
let h0 = ST.get () in
carry_pass_store f;
let h1 = ST.get () in
SC.lemma_carry_pass_store_first (as_seq h0 f);
carry_pass_store f;
let h2 = ST.get () in
SC.lemma_carry_pass_store_second (as_seq h1 f);
let f0 = f.(0ul) in
let f1 = f.(1ul) in
let f2 = f.(2ul) in
let f3 = f.(3ul) in
S.bn_v_is_as_nat (as_seq h0 f);
S.bn_v_is_as_nat (as_seq h2 f);
let (o0, o1, o2, o3) = SC.subtract_p4 (f0, f1, f2, f3) in
assert (S.as_nat4 (o0, o1, o2, o3) < P.prime);
assert (S.as_nat4 (o0, o1, o2, o3) == (as_nat h2 f) % P.prime);
u64s.(0ul) <- o0;
u64s.(1ul) <- o1;
u64s.(2ul) <- o2;
u64s.(3ul) <- o3;
let h3 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h3 u64s);
BSeq.lemma_nat_from_to_intseq_le_preserves_value 4 (as_seq h3 u64s)
inline_for_extraction noextract
val set_zero: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == 0)
let set_zero f =
f.(0ul) <- u64 0;
f.(1ul) <- u64 0;
f.(2ul) <- u64 0;
f.(3ul) <- u64 0
inline_for_extraction noextract
val set_one: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == 1) | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Hacl.Impl.Curve25519.Field64.felem -> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.Curve25519.Field64.felem",
"Lib.Buffer.op_Array_Assignment",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.u64",
"Prims.unit"
] | [] | false | true | false | false | false | let set_one f =
| f.(0ul) <- u64 1;
f.(1ul) <- u64 0;
f.(2ul) <- u64 0;
f.(3ul) <- u64 0 | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.copy_felem | val copy_felem:
f1:felem
-> f2:felem ->
Stack unit
(requires fun h ->
live h f1 /\ live h f2 /\ disjoint f1 f2)
(ensures fun h0 _ h1 ->
modifies (loc f1) h0 h1 /\
as_seq h1 f1 == as_seq h0 f2) | val copy_felem:
f1:felem
-> f2:felem ->
Stack unit
(requires fun h ->
live h f1 /\ live h f2 /\ disjoint f1 f2)
(ensures fun h0 _ h1 ->
modifies (loc f1) h0 h1 /\
as_seq h1 f1 == as_seq h0 f2) | let copy_felem f1 f2 =
f1.(0ul) <- f2.(0ul);
f1.(1ul) <- f2.(1ul);
f1.(2ul) <- f2.(2ul);
f1.(3ul) <- f2.(3ul);
let h1 = ST.get () in
LSeq.eq_intro (as_seq h1 f1) (as_seq h1 f2) | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 184,
"start_col": 0,
"start_line": 178
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul
let felem = lbuffer uint64 4ul
let felem2 = lbuffer uint64 8ul
noextract
let as_nat (h:mem) (e:felem) : GTot nat =
let s = as_seq h e in
let s0 = s.[0] in
let s1 = s.[1] in
let s2 = s.[2] in
let s3 = s.[3] in
S.as_nat4 (s0, s1, s2, s3)
noextract
let fevalh (h:mem) (f:felem) : GTot P.elem = (as_nat h f) % P.prime
inline_for_extraction noextract
val create_felem: unit ->
StackInline felem
(requires fun _ -> True)
(ensures fun h0 f h1 ->
stack_allocated f h0 h1 (Seq.create 4 (u64 0)) /\
as_nat h1 f == 0)
let create_felem () = create 4ul (u64 0)
inline_for_extraction noextract
val load_felem:
f:felem
-> u64s:lbuffer uint64 4ul ->
Stack unit
(requires fun h ->
live h u64s /\ live h f /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s))
let load_felem f u64s =
let h0 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h0 u64s);
f.(0ul) <- u64s.(0ul);
f.(1ul) <- u64s.(1ul);
f.(2ul) <- u64s.(2ul);
f.(3ul) <- u64s.(3ul)
val carry_pass_store: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_seq h1 f == SC.carry_pass_store (as_seq h0 f))
[@ Meta.Attribute.inline_ ]
let carry_pass_store f =
let f3 = f.(3ul) in
let top_bit = f3 >>. 63ul in
f.(3ul) <- f3 &. u64 0x7fffffffffffffff;
let h0 = ST.get () in
let carry = add1 f f (u64 19 *! top_bit) in
let h1 = ST.get () in
assert (as_nat h1 f + v carry * pow2 256 == as_nat h0 f + 19 * v top_bit);
S.bn_v_is_as_nat (as_seq h1 f);
S.bn_v_is_as_nat (as_seq h0 f);
let cr = Ghost.hide (Hacl.Spec.Curve25519.Field64.Core.add1 (as_seq h0 f) (u64 19 *! top_bit)) in
SD.bn_eval_bound (snd cr) 4;
assert (v (fst cr) == v carry /\ SD.bn_v (snd cr) == as_nat h1 f);
SD.bn_eval_inj 4 (snd cr) (as_seq h1 f);
()
val store_felem:
u64s:lbuffer uint64 4ul
-> f:felem ->
Stack unit
(requires fun h ->
live h f /\ live h u64s /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc u64s |+| loc f) h0 h1 /\
as_seq h1 u64s == BSeq.nat_to_intseq_le 4 (fevalh h0 f))
[@ Meta.Attribute.inline_ ]
let store_felem u64s f =
let h0 = ST.get () in
carry_pass_store f;
let h1 = ST.get () in
SC.lemma_carry_pass_store_first (as_seq h0 f);
carry_pass_store f;
let h2 = ST.get () in
SC.lemma_carry_pass_store_second (as_seq h1 f);
let f0 = f.(0ul) in
let f1 = f.(1ul) in
let f2 = f.(2ul) in
let f3 = f.(3ul) in
S.bn_v_is_as_nat (as_seq h0 f);
S.bn_v_is_as_nat (as_seq h2 f);
let (o0, o1, o2, o3) = SC.subtract_p4 (f0, f1, f2, f3) in
assert (S.as_nat4 (o0, o1, o2, o3) < P.prime);
assert (S.as_nat4 (o0, o1, o2, o3) == (as_nat h2 f) % P.prime);
u64s.(0ul) <- o0;
u64s.(1ul) <- o1;
u64s.(2ul) <- o2;
u64s.(3ul) <- o3;
let h3 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h3 u64s);
BSeq.lemma_nat_from_to_intseq_le_preserves_value 4 (as_seq h3 u64s)
inline_for_extraction noextract
val set_zero: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == 0)
let set_zero f =
f.(0ul) <- u64 0;
f.(1ul) <- u64 0;
f.(2ul) <- u64 0;
f.(3ul) <- u64 0
inline_for_extraction noextract
val set_one: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == 1)
let set_one f =
f.(0ul) <- u64 1;
f.(1ul) <- u64 0;
f.(2ul) <- u64 0;
f.(3ul) <- u64 0
inline_for_extraction noextract
val copy_felem:
f1:felem
-> f2:felem ->
Stack unit
(requires fun h ->
live h f1 /\ live h f2 /\ disjoint f1 f2)
(ensures fun h0 _ h1 ->
modifies (loc f1) h0 h1 /\
as_seq h1 f1 == as_seq h0 f2) | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f1: Hacl.Impl.Curve25519.Field64.felem -> f2: Hacl.Impl.Curve25519.Field64.felem
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.Curve25519.Field64.felem",
"Lib.Sequence.eq_intro",
"Lib.IntTypes.uint64",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.UInt32.__uint_to_t",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.op_Array_Assignment",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Lib.Buffer.op_Array_Access"
] | [] | false | true | false | false | false | let copy_felem f1 f2 =
| f1.(0ul) <- f2.(0ul);
f1.(1ul) <- f2.(1ul);
f1.(2ul) <- f2.(2ul);
f1.(3ul) <- f2.(3ul);
let h1 = ST.get () in
LSeq.eq_intro (as_seq h1 f1) (as_seq h1 f2) | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.carry_pass_store | val carry_pass_store: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_seq h1 f == SC.carry_pass_store (as_seq h0 f)) | val carry_pass_store: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_seq h1 f == SC.carry_pass_store (as_seq h0 f)) | let carry_pass_store f =
let f3 = f.(3ul) in
let top_bit = f3 >>. 63ul in
f.(3ul) <- f3 &. u64 0x7fffffffffffffff;
let h0 = ST.get () in
let carry = add1 f f (u64 19 *! top_bit) in
let h1 = ST.get () in
assert (as_nat h1 f + v carry * pow2 256 == as_nat h0 f + 19 * v top_bit);
S.bn_v_is_as_nat (as_seq h1 f);
S.bn_v_is_as_nat (as_seq h0 f);
let cr = Ghost.hide (Hacl.Spec.Curve25519.Field64.Core.add1 (as_seq h0 f) (u64 19 *! top_bit)) in
SD.bn_eval_bound (snd cr) 4;
assert (v (fst cr) == v carry /\ SD.bn_v (snd cr) == as_nat h1 f);
SD.bn_eval_inj 4 (snd cr) (as_seq h1 f);
() | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 4,
"end_line": 97,
"start_col": 0,
"start_line": 83
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul
let felem = lbuffer uint64 4ul
let felem2 = lbuffer uint64 8ul
noextract
let as_nat (h:mem) (e:felem) : GTot nat =
let s = as_seq h e in
let s0 = s.[0] in
let s1 = s.[1] in
let s2 = s.[2] in
let s3 = s.[3] in
S.as_nat4 (s0, s1, s2, s3)
noextract
let fevalh (h:mem) (f:felem) : GTot P.elem = (as_nat h f) % P.prime
inline_for_extraction noextract
val create_felem: unit ->
StackInline felem
(requires fun _ -> True)
(ensures fun h0 f h1 ->
stack_allocated f h0 h1 (Seq.create 4 (u64 0)) /\
as_nat h1 f == 0)
let create_felem () = create 4ul (u64 0)
inline_for_extraction noextract
val load_felem:
f:felem
-> u64s:lbuffer uint64 4ul ->
Stack unit
(requires fun h ->
live h u64s /\ live h f /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s))
let load_felem f u64s =
let h0 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h0 u64s);
f.(0ul) <- u64s.(0ul);
f.(1ul) <- u64s.(1ul);
f.(2ul) <- u64s.(2ul);
f.(3ul) <- u64s.(3ul)
val carry_pass_store: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_seq h1 f == SC.carry_pass_store (as_seq h0 f)) | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Hacl.Impl.Curve25519.Field64.felem -> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.Curve25519.Field64.felem",
"Prims.unit",
"Hacl.Spec.Bignum.Definitions.bn_eval_inj",
"Lib.IntTypes.U64",
"FStar.Pervasives.Native.snd",
"Lib.IntTypes.uint64",
"Hacl.Spec.Curve25519.Field64.Core.felem",
"FStar.Ghost.reveal",
"FStar.Pervasives.Native.tuple2",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"FStar.UInt32.__uint_to_t",
"Prims._assert",
"Prims.l_and",
"Prims.eq2",
"Lib.IntTypes.range_t",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"FStar.Pervasives.Native.fst",
"Prims.nat",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Hacl.Impl.Curve25519.Field64.as_nat",
"Hacl.Spec.Bignum.Definitions.bn_eval_bound",
"FStar.Ghost.erased",
"Lib.IntTypes.int_t",
"Hacl.Spec.Bignum.Definitions.lbignum",
"FStar.Ghost.hide",
"Hacl.Spec.Curve25519.Field64.Core.add1",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.u64",
"Hacl.Spec.Curve25519.Field64.Definition.bn_v_is_as_nat",
"Prims.int",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.pow2",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Impl.Curve25519.Fields.Core.add1",
"Lib.Buffer.op_Array_Assignment",
"Lib.IntTypes.op_Amp_Dot",
"Lib.IntTypes.op_Greater_Greater_Dot",
"Lib.Buffer.op_Array_Access"
] | [] | false | true | false | false | false | let carry_pass_store f =
| let f3 = f.(3ul) in
let top_bit = f3 >>. 63ul in
f.(3ul) <- f3 &. u64 0x7fffffffffffffff;
let h0 = ST.get () in
let carry = add1 f f (u64 19 *! top_bit) in
let h1 = ST.get () in
assert (as_nat h1 f + v carry * pow2 256 == as_nat h0 f + 19 * v top_bit);
S.bn_v_is_as_nat (as_seq h1 f);
S.bn_v_is_as_nat (as_seq h0 f);
let cr = Ghost.hide (Hacl.Spec.Curve25519.Field64.Core.add1 (as_seq h0 f) (u64 19 *! top_bit)) in
SD.bn_eval_bound (snd cr) 4;
assert (v (fst cr) == v carry /\ SD.bn_v (snd cr) == as_nat h1 f);
SD.bn_eval_inj 4 (snd cr) (as_seq h1 f);
() | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.eloc_union | val eloc_union (l1 l2: eloc) : Tot eloc | val eloc_union (l1 l2: eloc) : Tot eloc | let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2 | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 58,
"end_line": 32,
"start_col": 0,
"start_line": 32
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l1: EverParse3d.Actions.Base.eloc -> l2: EverParse3d.Actions.Base.eloc
-> EverParse3d.Actions.Base.eloc | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.eloc",
"FStar.Ghost.hide",
"LowStar.Monotonic.Buffer.loc",
"LowStar.Monotonic.Buffer.loc_union",
"FStar.Ghost.reveal"
] | [] | false | false | false | true | false | let eloc_union (l1 l2: eloc) : Tot eloc =
| B.loc_union l1 l2 | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.conj_inv | val conj_inv (i0 i1: slice_inv) : Tot slice_inv | val conj_inv (i0 i1: slice_inv) : Tot slice_inv | let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h) | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 86,
"end_line": 30,
"start_col": 0,
"start_line": 30
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i0: EverParse3d.Actions.Base.slice_inv -> i1: EverParse3d.Actions.Base.slice_inv
-> EverParse3d.Actions.Base.slice_inv | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.slice_inv",
"FStar.FunctionalExtensionality.on",
"FStar.Monotonic.HyperStack.mem",
"Prims.prop",
"Prims.l_and"
] | [] | false | false | false | true | false | let conj_inv (i0 i1: slice_inv) : slice_inv =
| F.on HS.mem #prop (fun h -> i0 h /\ i1 h) | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.app_ctxt | val app_ctxt : Type0 | let app_ctxt = AppCtxt.app_ctxt | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 31,
"end_line": 115,
"start_col": 0,
"start_line": 115
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2
let imp_disjointness p1 p2 = p1 ==> p2
let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none)
(disjointness_trivial)
let disjoint_none_l l =
FStar.PropositionalExtensionality.apply
(disjoint eloc_none l)
(disjointness_trivial)
let conj_disjointness_trivial_left_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d
let conj_disjointness_trivial_right_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (d `conj_disjointness` disjointness_trivial) d
let imp_disjointness_refl (d:disjointness_pre)
= ()
let index_equations ()
= introduce forall d. _
with conj_inv_true_left_unit d;
introduce forall d. _
with conj_inv_true_right_unit d;
introduce forall l. _
with eloc_union_none_right_unit l;
introduce forall l. _
with eloc_union_none_left_unit l;
introduce forall l. _
with disjoint_none_r l;
introduce forall l. _
with disjoint_none_l l;
introduce forall d. _
with conj_disjointness_trivial_left_unit d;
introduce forall d. _
with conj_disjointness_trivial_right_unit d;
introduce forall d. _
with imp_disjointness_refl d;
introduce forall i. _
with inv_implies_refl i;
introduce forall i. _
with inv_implies_true i;
introduce forall i0 i1 i2.
(i0 `inv_implies` i1 /\
i0 `inv_implies` i2) ==>
(i0 `inv_implies` (i1 `conj_inv` i2))
with introduce _ ==> _
with _ . inv_implies_conj i0 i1 i2 () ();
introduce forall l. _
with eloc_includes_none l;
introduce forall l0 l1 l2. (l0 `eloc_includes` l1 /\
l0 `eloc_includes` l2) ==>
(l0 `eloc_includes` (l1 `eloc_union` l2))
with introduce _ ==> _
with _ . eloc_includes_union l0 l1 l2 () ();
introduce forall l. _
with eloc_includes_refl l
let bpointer a = B.pointer a
let ptr_loc #a (x:B.pointer a) : Tot eloc = B.loc_buffer x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.AppCtxt.app_ctxt"
] | [] | false | false | false | true | true | let app_ctxt =
| AppCtxt.app_ctxt | false |
|
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.input_buffer_t | val input_buffer_t : Type0 | let input_buffer_t = EverParse3d.InputStream.All.t | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 50,
"end_line": 122,
"start_col": 0,
"start_line": 122
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2
let imp_disjointness p1 p2 = p1 ==> p2
let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none)
(disjointness_trivial)
let disjoint_none_l l =
FStar.PropositionalExtensionality.apply
(disjoint eloc_none l)
(disjointness_trivial)
let conj_disjointness_trivial_left_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d
let conj_disjointness_trivial_right_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (d `conj_disjointness` disjointness_trivial) d
let imp_disjointness_refl (d:disjointness_pre)
= ()
let index_equations ()
= introduce forall d. _
with conj_inv_true_left_unit d;
introduce forall d. _
with conj_inv_true_right_unit d;
introduce forall l. _
with eloc_union_none_right_unit l;
introduce forall l. _
with eloc_union_none_left_unit l;
introduce forall l. _
with disjoint_none_r l;
introduce forall l. _
with disjoint_none_l l;
introduce forall d. _
with conj_disjointness_trivial_left_unit d;
introduce forall d. _
with conj_disjointness_trivial_right_unit d;
introduce forall d. _
with imp_disjointness_refl d;
introduce forall i. _
with inv_implies_refl i;
introduce forall i. _
with inv_implies_true i;
introduce forall i0 i1 i2.
(i0 `inv_implies` i1 /\
i0 `inv_implies` i2) ==>
(i0 `inv_implies` (i1 `conj_inv` i2))
with introduce _ ==> _
with _ . inv_implies_conj i0 i1 i2 () ();
introduce forall l. _
with eloc_includes_none l;
introduce forall l0 l1 l2. (l0 `eloc_includes` l1 /\
l0 `eloc_includes` l2) ==>
(l0 `eloc_includes` (l1 `eloc_union` l2))
with introduce _ ==> _
with _ . eloc_includes_union l0 l1 l2 () ();
introduce forall l. _
with eloc_includes_refl l
let bpointer a = B.pointer a
let ptr_loc #a (x:B.pointer a) : Tot eloc = B.loc_buffer x
let ptr_inv #a (x:B.pointer a) : slice_inv = F.on HS.mem #prop (fun h -> B.live h x /\ True)
let app_ctxt = AppCtxt.app_ctxt
let app_loc (x:AppCtxt.app_ctxt) (l:eloc) : eloc =
AppCtxt.properties x;
AppCtxt.loc_of x `loc_union` l
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.InputStream.All.t"
] | [] | false | false | false | true | true | let input_buffer_t =
| EverParse3d.InputStream.All.t | false |
|
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.conj_inv_true_left_unit | val conj_inv_true_left_unit (inv:slice_inv) : Tot (squash (true_inv `conj_inv` inv == inv)) | val conj_inv_true_left_unit (inv:slice_inv) : Tot (squash (true_inv `conj_inv` inv == inv)) | let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 81,
"end_line": 40,
"start_col": 0,
"start_line": 39
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | inv: EverParse3d.Actions.Base.slice_inv
-> Prims.squash (EverParse3d.Actions.Base.conj_inv EverParse3d.Actions.Base.true_inv inv == inv) | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.slice_inv",
"FStar.PredicateExtensionality.predicateExtensionality",
"FStar.Monotonic.HyperStack.mem",
"EverParse3d.Actions.Base.conj_inv",
"EverParse3d.Actions.Base.true_inv",
"Prims.squash",
"Prims.eq2"
] | [] | false | false | true | false | false | let conj_inv_true_left_unit i =
| FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.eloc_none | val eloc_none : eloc | val eloc_none : eloc | let eloc_none : eloc = B.loc_none | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 33,
"end_line": 33,
"start_col": 0,
"start_line": 33
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l }) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Actions.Base.eloc | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.hide",
"LowStar.Monotonic.Buffer.loc",
"LowStar.Monotonic.Buffer.loc_none",
"EverParse3d.Actions.Base.eloc"
] | [] | false | false | false | true | false | let eloc_none:eloc =
| B.loc_none | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.conj_inv_true_right_unit | val conj_inv_true_right_unit (inv:slice_inv) : Tot (squash (inv `conj_inv` true_inv == inv)) | val conj_inv_true_right_unit (inv:slice_inv) : Tot (squash (inv `conj_inv` true_inv == inv)) | let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 81,
"end_line": 42,
"start_col": 0,
"start_line": 41
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i = | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | inv: EverParse3d.Actions.Base.slice_inv
-> Prims.squash (EverParse3d.Actions.Base.conj_inv inv EverParse3d.Actions.Base.true_inv == inv) | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.slice_inv",
"FStar.PredicateExtensionality.predicateExtensionality",
"FStar.Monotonic.HyperStack.mem",
"EverParse3d.Actions.Base.conj_inv",
"EverParse3d.Actions.Base.true_inv",
"Prims.squash",
"Prims.eq2"
] | [] | false | false | true | false | false | let conj_inv_true_right_unit i =
| FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.validate_with_action_t | val validate_with_action_t
(#nz:bool)
(#wk: _)
(#k:parser_kind nz wk)
(#t:Type)
(p:parser k t)
(liveness_inv:slice_inv)
(disj:disjointness_pre)
(l:eloc)
(allow_reading:bool)
: Type0 | val validate_with_action_t
(#nz:bool)
(#wk: _)
(#k:parser_kind nz wk)
(#t:Type)
(p:parser k t)
(liveness_inv:slice_inv)
(disj:disjointness_pre)
(l:eloc)
(allow_reading:bool)
: Type0 | let validate_with_action_t p inv disj l allow_reading = validate_with_action_t' p inv disj l allow_reading | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 106,
"end_line": 280,
"start_col": 0,
"start_line": 280
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2
let imp_disjointness p1 p2 = p1 ==> p2
let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none)
(disjointness_trivial)
let disjoint_none_l l =
FStar.PropositionalExtensionality.apply
(disjoint eloc_none l)
(disjointness_trivial)
let conj_disjointness_trivial_left_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d
let conj_disjointness_trivial_right_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (d `conj_disjointness` disjointness_trivial) d
let imp_disjointness_refl (d:disjointness_pre)
= ()
let index_equations ()
= introduce forall d. _
with conj_inv_true_left_unit d;
introduce forall d. _
with conj_inv_true_right_unit d;
introduce forall l. _
with eloc_union_none_right_unit l;
introduce forall l. _
with eloc_union_none_left_unit l;
introduce forall l. _
with disjoint_none_r l;
introduce forall l. _
with disjoint_none_l l;
introduce forall d. _
with conj_disjointness_trivial_left_unit d;
introduce forall d. _
with conj_disjointness_trivial_right_unit d;
introduce forall d. _
with imp_disjointness_refl d;
introduce forall i. _
with inv_implies_refl i;
introduce forall i. _
with inv_implies_true i;
introduce forall i0 i1 i2.
(i0 `inv_implies` i1 /\
i0 `inv_implies` i2) ==>
(i0 `inv_implies` (i1 `conj_inv` i2))
with introduce _ ==> _
with _ . inv_implies_conj i0 i1 i2 () ();
introduce forall l. _
with eloc_includes_none l;
introduce forall l0 l1 l2. (l0 `eloc_includes` l1 /\
l0 `eloc_includes` l2) ==>
(l0 `eloc_includes` (l1 `eloc_union` l2))
with introduce _ ==> _
with _ . eloc_includes_union l0 l1 l2 () ();
introduce forall l. _
with eloc_includes_refl l
let bpointer a = B.pointer a
let ptr_loc #a (x:B.pointer a) : Tot eloc = B.loc_buffer x
let ptr_inv #a (x:B.pointer a) : slice_inv = F.on HS.mem #prop (fun h -> B.live h x /\ True)
let app_ctxt = AppCtxt.app_ctxt
let app_loc (x:AppCtxt.app_ctxt) (l:eloc) : eloc =
AppCtxt.properties x;
AppCtxt.loc_of x `loc_union` l
inline_for_extraction
noextract
let input_buffer_t = EverParse3d.InputStream.All.t
inline_for_extraction
let error_handler =
typename:string ->
fieldname:string ->
error_reason:string ->
error_code:U64.t ->
ctxt: app_ctxt ->
sl: input_buffer_t ->
pos: LPE.pos_t ->
Stack unit
(requires fun h ->
I.live sl h /\
true_inv h /\
B.live h ctxt /\
loc_not_unused_in h `loc_includes` app_loc ctxt eloc_none /\
address_liveness_insensitive_locs `loc_includes` app_loc ctxt eloc_none /\
app_loc ctxt eloc_none `loc_disjoint` I.footprint sl /\
U64.v pos <= Seq.length (I.get_read sl h)
)
(ensures fun h0 _ h1 ->
let sl = Ghost.reveal sl in
modifies (app_loc ctxt eloc_none) h0 h1 /\
B.live h1 ctxt /\
true_inv h1)
let action
inv disj l on_success a
= (# [EverParse3d.Util.solve_from_ctx ()] I.extra_t #input_buffer_t) ->
ctxt: app_ctxt ->
error_handler_fn : error_handler ->
sl: input_buffer_t ->
len: I.tlen sl ->
pos: LPE.pos_t ->
posf: LPE.pos_t ->
Stack a
(requires fun h ->
I.live sl h /\
disj /\
inv h /\
B.live h ctxt /\
loc_not_unused_in h `loc_includes` app_loc ctxt l /\
address_liveness_insensitive_locs `loc_includes` app_loc ctxt l /\
app_loc ctxt l `loc_disjoint` I.footprint sl /\
U64.v pos <= U64.v posf /\
U64.v posf == Seq.length (I.get_read sl h)
)
(ensures fun h0 _ h1 ->
let sl = Ghost.reveal sl in
modifies (app_loc ctxt l) h0 h1 /\
B.live h1 ctxt /\
inv h1)
module LP = LowParse.Spec.Base
module LPL = LowParse.Low.Base
unfold
let valid_consumed
(#input_buffer_t: Type0)
(# [tcresolve ()] inst : I.input_stream_inst input_buffer_t)
(#k: LP.parser_kind)
(#t: Type)
(p: LP.parser k t)
(h: HS.mem)
(h': HS.mem)
(sl: input_buffer_t)
: Tot prop
= I.live sl h /\
I.live sl h' /\
begin
let s = I.get_remaining sl h in
begin match LP.parse p s with
| None -> False
| Some (_, len) -> I.get_remaining sl h' `Seq.equal` Seq.slice s len (Seq.length s)
end
end
unfold
let valid_length
(#input_buffer_t: Type0)
(# [tcresolve ()] inst : I.input_stream_inst input_buffer_t)
(#k: LP.parser_kind)
(#t: Type)
(p: LP.parser k t)
(h: HS.mem)
(sl: input_buffer_t)
(len: int)
: Tot prop
= I.live sl h /\
begin
let s = I.get_remaining sl h in
begin match LP.parse p s with
| None -> False
| Some (_, len') -> len == len'
end
end
let valid
(#input_buffer_t: Type0)
(# [tcresolve ()] inst : I.input_stream_inst input_buffer_t)
(#k: LP.parser_kind)
(#t: Type)
(p: LP.parser k t)
(h: HS.mem)
(sl: input_buffer_t)
: Tot prop
= I.live sl h /\
Some? (LP.parse p (I.get_remaining sl h))
inline_for_extraction noextract
let validate_with_action_t'
(#k:LP.parser_kind)
(#t:Type)
(p:LP.parser k t)
(inv:slice_inv)
(disj:disjointness_pre)
(l:eloc)
(allow_reading:bool)
: Type
= (# [EverParse3d.Util.solve_from_ctx ()] I.extra_t #input_buffer_t) ->
(ctxt: app_ctxt) ->
(error_handler_fn : error_handler) ->
(sl: input_buffer_t) ->
(len: I.tlen sl) ->
(pos: LPE.pos_t) ->
Stack U64.t
(requires fun h ->
I.live sl h /\
disj /\
inv h /\
B.live h ctxt /\
loc_not_unused_in h `loc_includes` app_loc ctxt l /\
address_liveness_insensitive_locs `loc_includes` app_loc ctxt l /\
U64.v pos == Seq.length (I.get_read sl h) /\
app_loc ctxt l `loc_disjoint` I.footprint sl
)
(ensures fun h res h' ->
I.live sl h' /\
modifies (app_loc ctxt l `loc_union` I.perm_footprint sl) h h' /\
inv h' /\
B.live h' ctxt /\
(((~ allow_reading) \/ LPE.is_error res) ==> U64.v (LPE.get_validator_error_pos res) == Seq.length (I.get_read sl h')) /\
begin let s = I.get_remaining sl h in
if LPE.is_success res
then
begin if allow_reading
then U64.v res >= U64.v pos /\ valid_length p h sl (U64.v res - U64.v pos) /\ I.get_remaining sl h' == s
else valid_consumed p h h' sl
end
else
let s' = I.get_remaining sl h' in
(LPE.get_validator_error_kind res <> LPE.get_validator_error_kind LPE.validator_error_action_failed ==> None? (LP.parse p s)) /\
Seq.length s' <= Seq.length s /\
s' `Seq.equal` Seq.slice s (Seq.length s - Seq.length s') (Seq.length s)
end
) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Low.Base",
"short_module": "LPL"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: EverParse3d.Prelude.parser k t ->
liveness_inv: EverParse3d.Actions.Base.slice_inv ->
disj: EverParse3d.Actions.Base.disjointness_pre ->
l: EverParse3d.Actions.Base.eloc ->
allow_reading: Prims.bool
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"EverParse3d.Kinds.weak_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Prelude.parser",
"EverParse3d.Actions.Base.slice_inv",
"EverParse3d.Actions.Base.disjointness_pre",
"EverParse3d.Actions.Base.eloc",
"EverParse3d.Actions.Base.validate_with_action_t'"
] | [] | false | false | false | false | true | let validate_with_action_t p inv disj l allow_reading =
| validate_with_action_t' p inv disj l allow_reading | false |
Hacl.Impl.Curve25519.Field64.fst | Hacl.Impl.Curve25519.Field64.store_felem | val store_felem:
u64s:lbuffer uint64 4ul
-> f:felem ->
Stack unit
(requires fun h ->
live h f /\ live h u64s /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc u64s |+| loc f) h0 h1 /\
as_seq h1 u64s == BSeq.nat_to_intseq_le 4 (fevalh h0 f)) | val store_felem:
u64s:lbuffer uint64 4ul
-> f:felem ->
Stack unit
(requires fun h ->
live h f /\ live h u64s /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc u64s |+| loc f) h0 h1 /\
as_seq h1 u64s == BSeq.nat_to_intseq_le 4 (fevalh h0 f)) | let store_felem u64s f =
let h0 = ST.get () in
carry_pass_store f;
let h1 = ST.get () in
SC.lemma_carry_pass_store_first (as_seq h0 f);
carry_pass_store f;
let h2 = ST.get () in
SC.lemma_carry_pass_store_second (as_seq h1 f);
let f0 = f.(0ul) in
let f1 = f.(1ul) in
let f2 = f.(2ul) in
let f3 = f.(3ul) in
S.bn_v_is_as_nat (as_seq h0 f);
S.bn_v_is_as_nat (as_seq h2 f);
let (o0, o1, o2, o3) = SC.subtract_p4 (f0, f1, f2, f3) in
assert (S.as_nat4 (o0, o1, o2, o3) < P.prime);
assert (S.as_nat4 (o0, o1, o2, o3) == (as_nat h2 f) % P.prime);
u64s.(0ul) <- o0;
u64s.(1ul) <- o1;
u64s.(2ul) <- o2;
u64s.(3ul) <- o3;
let h3 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h3 u64s);
BSeq.lemma_nat_from_to_intseq_le_preserves_value 4 (as_seq h3 u64s) | {
"file_name": "code/curve25519/Hacl.Impl.Curve25519.Field64.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 134,
"start_col": 0,
"start_line": 111
} | module Hacl.Impl.Curve25519.Field64
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.Curve25519.Fields.Core
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module P = Spec.Curve25519
module S = Hacl.Spec.Curve25519.Field64.Definition
module SC = Hacl.Spec.Curve25519.Field64
module SD = Hacl.Spec.Bignum.Definitions
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let u256 = lbuffer uint64 4ul
let u512 = lbuffer uint64 8ul
let u1024 = lbuffer uint64 16ul
let felem = lbuffer uint64 4ul
let felem2 = lbuffer uint64 8ul
noextract
let as_nat (h:mem) (e:felem) : GTot nat =
let s = as_seq h e in
let s0 = s.[0] in
let s1 = s.[1] in
let s2 = s.[2] in
let s3 = s.[3] in
S.as_nat4 (s0, s1, s2, s3)
noextract
let fevalh (h:mem) (f:felem) : GTot P.elem = (as_nat h f) % P.prime
inline_for_extraction noextract
val create_felem: unit ->
StackInline felem
(requires fun _ -> True)
(ensures fun h0 f h1 ->
stack_allocated f h0 h1 (Seq.create 4 (u64 0)) /\
as_nat h1 f == 0)
let create_felem () = create 4ul (u64 0)
inline_for_extraction noextract
val load_felem:
f:felem
-> u64s:lbuffer uint64 4ul ->
Stack unit
(requires fun h ->
live h u64s /\ live h f /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s))
let load_felem f u64s =
let h0 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h0 u64s);
f.(0ul) <- u64s.(0ul);
f.(1ul) <- u64s.(1ul);
f.(2ul) <- u64s.(2ul);
f.(3ul) <- u64s.(3ul)
val carry_pass_store: f:felem ->
Stack unit
(requires fun h -> live h f)
(ensures fun h0 _ h1 ->
modifies (loc f) h0 h1 /\
as_seq h1 f == SC.carry_pass_store (as_seq h0 f))
[@ Meta.Attribute.inline_ ]
let carry_pass_store f =
let f3 = f.(3ul) in
let top_bit = f3 >>. 63ul in
f.(3ul) <- f3 &. u64 0x7fffffffffffffff;
let h0 = ST.get () in
let carry = add1 f f (u64 19 *! top_bit) in
let h1 = ST.get () in
assert (as_nat h1 f + v carry * pow2 256 == as_nat h0 f + 19 * v top_bit);
S.bn_v_is_as_nat (as_seq h1 f);
S.bn_v_is_as_nat (as_seq h0 f);
let cr = Ghost.hide (Hacl.Spec.Curve25519.Field64.Core.add1 (as_seq h0 f) (u64 19 *! top_bit)) in
SD.bn_eval_bound (snd cr) 4;
assert (v (fst cr) == v carry /\ SD.bn_v (snd cr) == as_nat h1 f);
SD.bn_eval_inj 4 (snd cr) (as_seq h1 f);
()
val store_felem:
u64s:lbuffer uint64 4ul
-> f:felem ->
Stack unit
(requires fun h ->
live h f /\ live h u64s /\ disjoint u64s f)
(ensures fun h0 _ h1 ->
modifies (loc u64s |+| loc f) h0 h1 /\
as_seq h1 u64s == BSeq.nat_to_intseq_le 4 (fevalh h0 f)) | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Curve25519.Field64.Core.fst.checked",
"Hacl.Spec.Curve25519.Field64.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Impl.Curve25519.Lemmas.fst.checked",
"Hacl.Impl.Curve25519.Fields.Core.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Curve25519.Field64.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519.Fields.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | u64s: Lib.Buffer.lbuffer Lib.IntTypes.uint64 4ul -> f: Hacl.Impl.Curve25519.Field64.felem
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.Curve25519.Field64.felem",
"Lib.ByteSequence.lemma_nat_from_to_intseq_le_preserves_value",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Prims.unit",
"Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.op_Array_Assignment",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"Hacl.Spec.Curve25519.Field64.Definition.as_nat4",
"FStar.Pervasives.Native.Mktuple4",
"Prims.op_Modulus",
"Hacl.Impl.Curve25519.Field64.as_nat",
"Spec.Curve25519.prime",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Spec.Curve25519.Field64.Definition.felem4",
"Hacl.Spec.Curve25519.Field64.subtract_p4",
"Hacl.Spec.Curve25519.Field64.Definition.bn_v_is_as_nat",
"Lib.IntTypes.int_t",
"Lib.Buffer.op_Array_Access",
"Hacl.Spec.Curve25519.Field64.lemma_carry_pass_store_second",
"Hacl.Impl.Curve25519.Field64.carry_pass_store",
"Hacl.Spec.Curve25519.Field64.lemma_carry_pass_store_first"
] | [] | false | true | false | false | false | let store_felem u64s f =
| let h0 = ST.get () in
carry_pass_store f;
let h1 = ST.get () in
SC.lemma_carry_pass_store_first (as_seq h0 f);
carry_pass_store f;
let h2 = ST.get () in
SC.lemma_carry_pass_store_second (as_seq h1 f);
let f0 = f.(0ul) in
let f1 = f.(1ul) in
let f2 = f.(2ul) in
let f3 = f.(3ul) in
S.bn_v_is_as_nat (as_seq h0 f);
S.bn_v_is_as_nat (as_seq h2 f);
let o0, o1, o2, o3 = SC.subtract_p4 (f0, f1, f2, f3) in
assert (S.as_nat4 (o0, o1, o2, o3) < P.prime);
assert (S.as_nat4 (o0, o1, o2, o3) == (as_nat h2 f) % P.prime);
u64s.(0ul) <- o0;
u64s.(1ul) <- o1;
u64s.(2ul) <- o2;
u64s.(3ul) <- o3;
let h3 = ST.get () in
Hacl.Impl.Curve25519.Lemmas.lemma_nat_from_uints64_le_4 (as_seq h3 u64s);
BSeq.lemma_nat_from_to_intseq_le_preserves_value 4 (as_seq h3 u64s) | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.disjoint_none_l | val disjoint_none_l (l:eloc)
: squash (disjoint eloc_none l == disjointness_trivial) | val disjoint_none_l (l:eloc)
: squash (disjoint eloc_none l == disjointness_trivial) | let disjoint_none_l l =
FStar.PropositionalExtensionality.apply
(disjoint eloc_none l)
(disjointness_trivial) | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 28,
"end_line": 62,
"start_col": 0,
"start_line": 59
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2
let imp_disjointness p1 p2 = p1 ==> p2
let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: EverParse3d.Actions.Base.eloc
-> Prims.squash (EverParse3d.Actions.Base.disjoint EverParse3d.Actions.Base.eloc_none l ==
EverParse3d.Actions.Base.disjointness_trivial) | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.eloc",
"FStar.PropositionalExtensionality.apply",
"EverParse3d.Actions.Base.disjoint",
"EverParse3d.Actions.Base.eloc_none",
"EverParse3d.Actions.Base.disjointness_trivial",
"Prims.squash",
"Prims.eq2",
"EverParse3d.Actions.Base.disjointness_pre"
] | [] | false | false | true | false | false | let disjoint_none_l l =
| FStar.PropositionalExtensionality.apply (disjoint eloc_none l) (disjointness_trivial) | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.ptr_inv | val ptr_inv (#a: _) (x: bpointer a) : Tot slice_inv | val ptr_inv (#a: _) (x: bpointer a) : Tot slice_inv | let ptr_inv #a (x:B.pointer a) : slice_inv = F.on HS.mem #prop (fun h -> B.live h x /\ True) | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 92,
"end_line": 114,
"start_col": 0,
"start_line": 114
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2
let imp_disjointness p1 p2 = p1 ==> p2
let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none)
(disjointness_trivial)
let disjoint_none_l l =
FStar.PropositionalExtensionality.apply
(disjoint eloc_none l)
(disjointness_trivial)
let conj_disjointness_trivial_left_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d
let conj_disjointness_trivial_right_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (d `conj_disjointness` disjointness_trivial) d
let imp_disjointness_refl (d:disjointness_pre)
= ()
let index_equations ()
= introduce forall d. _
with conj_inv_true_left_unit d;
introduce forall d. _
with conj_inv_true_right_unit d;
introduce forall l. _
with eloc_union_none_right_unit l;
introduce forall l. _
with eloc_union_none_left_unit l;
introduce forall l. _
with disjoint_none_r l;
introduce forall l. _
with disjoint_none_l l;
introduce forall d. _
with conj_disjointness_trivial_left_unit d;
introduce forall d. _
with conj_disjointness_trivial_right_unit d;
introduce forall d. _
with imp_disjointness_refl d;
introduce forall i. _
with inv_implies_refl i;
introduce forall i. _
with inv_implies_true i;
introduce forall i0 i1 i2.
(i0 `inv_implies` i1 /\
i0 `inv_implies` i2) ==>
(i0 `inv_implies` (i1 `conj_inv` i2))
with introduce _ ==> _
with _ . inv_implies_conj i0 i1 i2 () ();
introduce forall l. _
with eloc_includes_none l;
introduce forall l0 l1 l2. (l0 `eloc_includes` l1 /\
l0 `eloc_includes` l2) ==>
(l0 `eloc_includes` (l1 `eloc_union` l2))
with introduce _ ==> _
with _ . eloc_includes_union l0 l1 l2 () ();
introduce forall l. _
with eloc_includes_refl l
let bpointer a = B.pointer a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: EverParse3d.Actions.Base.bpointer a -> EverParse3d.Actions.Base.slice_inv | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.pointer",
"FStar.FunctionalExtensionality.on",
"FStar.Monotonic.HyperStack.mem",
"Prims.prop",
"Prims.l_and",
"LowStar.Monotonic.Buffer.live",
"LowStar.Buffer.trivial_preorder",
"Prims.l_True",
"EverParse3d.Actions.Base.slice_inv"
] | [] | false | false | false | true | false | let ptr_inv #a (x: B.pointer a) : slice_inv =
| F.on HS.mem #prop (fun h -> B.live h x /\ True) | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.disjoint_none_r | val disjoint_none_r (l:eloc)
: squash (disjoint l eloc_none == disjointness_trivial) | val disjoint_none_r (l:eloc)
: squash (disjoint l eloc_none == disjointness_trivial) | let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none)
(disjointness_trivial) | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 28,
"end_line": 58,
"start_col": 0,
"start_line": 55
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: EverParse3d.Actions.Base.eloc
-> Prims.squash (EverParse3d.Actions.Base.disjoint l EverParse3d.Actions.Base.eloc_none ==
EverParse3d.Actions.Base.disjointness_trivial) | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.eloc",
"FStar.PropositionalExtensionality.apply",
"EverParse3d.Actions.Base.disjoint",
"EverParse3d.Actions.Base.eloc_none",
"EverParse3d.Actions.Base.disjointness_trivial",
"Prims.squash",
"Prims.eq2",
"EverParse3d.Actions.Base.disjointness_pre"
] | [] | false | false | true | false | false | let disjoint_none_r l =
| FStar.PropositionalExtensionality.apply (disjoint l eloc_none) (disjointness_trivial) | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.conj_disjointness_trivial_left_unit | val conj_disjointness_trivial_left_unit (d:disjointness_pre)
: squash ((disjointness_trivial `conj_disjointness` d) == d) | val conj_disjointness_trivial_left_unit (d:disjointness_pre)
: squash ((disjointness_trivial `conj_disjointness` d) == d) | let conj_disjointness_trivial_left_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 90,
"end_line": 65,
"start_col": 0,
"start_line": 64
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2
let imp_disjointness p1 p2 = p1 ==> p2
let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none)
(disjointness_trivial)
let disjoint_none_l l =
FStar.PropositionalExtensionality.apply
(disjoint eloc_none l)
(disjointness_trivial) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | d: EverParse3d.Actions.Base.disjointness_pre
-> Prims.squash (EverParse3d.Actions.Base.conj_disjointness EverParse3d.Actions.Base.disjointness_trivial
d ==
d) | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.disjointness_pre",
"FStar.PropositionalExtensionality.apply",
"EverParse3d.Actions.Base.conj_disjointness",
"EverParse3d.Actions.Base.disjointness_trivial",
"Prims.squash",
"Prims.eq2"
] | [] | false | false | true | false | false | let conj_disjointness_trivial_left_unit (d: disjointness_pre) =
| FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.conj_disjointness_trivial_right_unit | val conj_disjointness_trivial_right_unit (d:disjointness_pre)
: squash ((d `conj_disjointness` disjointness_trivial) == d) | val conj_disjointness_trivial_right_unit (d:disjointness_pre)
: squash ((d `conj_disjointness` disjointness_trivial) == d) | let conj_disjointness_trivial_right_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (d `conj_disjointness` disjointness_trivial) d | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 90,
"end_line": 68,
"start_col": 0,
"start_line": 67
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2
let imp_disjointness p1 p2 = p1 ==> p2
let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none)
(disjointness_trivial)
let disjoint_none_l l =
FStar.PropositionalExtensionality.apply
(disjoint eloc_none l)
(disjointness_trivial)
let conj_disjointness_trivial_left_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | d: EverParse3d.Actions.Base.disjointness_pre
-> Prims.squash (EverParse3d.Actions.Base.conj_disjointness d
EverParse3d.Actions.Base.disjointness_trivial ==
d) | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Actions.Base.disjointness_pre",
"FStar.PropositionalExtensionality.apply",
"EverParse3d.Actions.Base.conj_disjointness",
"EverParse3d.Actions.Base.disjointness_trivial",
"Prims.squash",
"Prims.eq2"
] | [] | false | false | true | false | false | let conj_disjointness_trivial_right_unit (d: disjointness_pre) =
| FStar.PropositionalExtensionality.apply (d `conj_disjointness` disjointness_trivial) d | false |
EverParse3d.Actions.Base.fst | EverParse3d.Actions.Base.validate_eta | val validate_eta
(#nz:bool)
(#wk: _)
(#k:parser_kind nz wk)
(#[@@@erasable] t:Type)
(#[@@@erasable] p:parser k t)
(#[@@@erasable] inv:slice_inv)
(#[@@@erasable] disj:disjointness_pre)
(#[@@@erasable] l:eloc)
(#allow_reading:bool)
(v: validate_with_action_t p inv disj l allow_reading)
: Tot (validate_with_action_t p inv disj l allow_reading) | val validate_eta
(#nz:bool)
(#wk: _)
(#k:parser_kind nz wk)
(#[@@@erasable] t:Type)
(#[@@@erasable] p:parser k t)
(#[@@@erasable] inv:slice_inv)
(#[@@@erasable] disj:disjointness_pre)
(#[@@@erasable] l:eloc)
(#allow_reading:bool)
(v: validate_with_action_t p inv disj l allow_reading)
: Tot (validate_with_action_t p inv disj l allow_reading) | let validate_eta v =
fun ctxt error_handler_fn sl pos -> v ctxt error_handler_fn sl pos | {
"file_name": "src/3d/prelude/EverParse3d.Actions.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 68,
"end_line": 283,
"start_col": 0,
"start_line": 282
} | module EverParse3d.Actions.Base
friend EverParse3d.Kinds
friend EverParse3d.Prelude
open FStar.HyperStack.ST
open LowStar.Buffer
open LowStar.BufferOps
module B = LowStar.Buffer
module I = EverParse3d.InputStream.Base
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module CP = EverParse3d.CopyBuffer
module AppCtxt = EverParse3d.AppCtxt
module LPE = EverParse3d.ErrorCode
open FStar.Tactics.Typeclasses
open FStar.FunctionalExtensionality
module B = LowStar.Buffer
module U8 = FStar.UInt8
module P = EverParse3d.Prelude
module F = FStar.FunctionalExtensionality
let hinv = HS.mem ^-> prop
let liveness_inv = i:hinv {
forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\ modifies l h0 h1 /\ address_liveness_insensitive_locs `loc_includes` l ==> i h1
}
let mem_inv = liveness_inv
let slice_inv = mem_inv
let inv_implies (inv0 inv1:slice_inv) =
forall h.
inv0 h ==> inv1 h
let true_inv : slice_inv = F.on HS.mem #prop (fun _ -> True)
let conj_inv (i0 i1:slice_inv) : slice_inv = F.on HS.mem #prop (fun h -> i0 h /\ i1 h)
let eloc = (l: FStar.Ghost.erased B.loc { B.address_liveness_insensitive_locs `B.loc_includes` l })
let eloc_union (l1 l2:eloc) : Tot eloc = B.loc_union l1 l2
let eloc_none : eloc = B.loc_none
let eloc_includes (l1 l2:eloc) = B.loc_includes l1 l2 /\ True
let eloc_disjoint (l1 l2:eloc) = B.loc_disjoint l1 l2 /\ True
let inv_implies_refl inv = ()
let inv_implies_true inv0 = ()
let inv_implies_conj inv0 inv1 inv2 h01 h02 = ()
let conj_inv_true_left_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv true_inv i) i
let conj_inv_true_right_unit i =
FStar.PredicateExtensionality.predicateExtensionality _ (conj_inv i true_inv) i
let eloc_includes_none l = ()
let eloc_includes_union l0 l1 l2 h01 h02 = ()
let eloc_includes_refl l = ()
let eloc_union_none_left_unit l = ()
let eloc_union_none_right_unit l = ()
let disjointness_pre = prop
let disjointness_trivial = True
let disjoint l1 l2 = eloc_disjoint l1 l2
let conj_disjointness p1 p2 = p1 /\ p2
let imp_disjointness p1 p2 = p1 ==> p2
let disjoint_none_r l =
FStar.PropositionalExtensionality.apply
(disjoint l eloc_none)
(disjointness_trivial)
let disjoint_none_l l =
FStar.PropositionalExtensionality.apply
(disjoint eloc_none l)
(disjointness_trivial)
let conj_disjointness_trivial_left_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d
let conj_disjointness_trivial_right_unit (d:disjointness_pre)
= FStar.PropositionalExtensionality.apply (d `conj_disjointness` disjointness_trivial) d
let imp_disjointness_refl (d:disjointness_pre)
= ()
let index_equations ()
= introduce forall d. _
with conj_inv_true_left_unit d;
introduce forall d. _
with conj_inv_true_right_unit d;
introduce forall l. _
with eloc_union_none_right_unit l;
introduce forall l. _
with eloc_union_none_left_unit l;
introduce forall l. _
with disjoint_none_r l;
introduce forall l. _
with disjoint_none_l l;
introduce forall d. _
with conj_disjointness_trivial_left_unit d;
introduce forall d. _
with conj_disjointness_trivial_right_unit d;
introduce forall d. _
with imp_disjointness_refl d;
introduce forall i. _
with inv_implies_refl i;
introduce forall i. _
with inv_implies_true i;
introduce forall i0 i1 i2.
(i0 `inv_implies` i1 /\
i0 `inv_implies` i2) ==>
(i0 `inv_implies` (i1 `conj_inv` i2))
with introduce _ ==> _
with _ . inv_implies_conj i0 i1 i2 () ();
introduce forall l. _
with eloc_includes_none l;
introduce forall l0 l1 l2. (l0 `eloc_includes` l1 /\
l0 `eloc_includes` l2) ==>
(l0 `eloc_includes` (l1 `eloc_union` l2))
with introduce _ ==> _
with _ . eloc_includes_union l0 l1 l2 () ();
introduce forall l. _
with eloc_includes_refl l
let bpointer a = B.pointer a
let ptr_loc #a (x:B.pointer a) : Tot eloc = B.loc_buffer x
let ptr_inv #a (x:B.pointer a) : slice_inv = F.on HS.mem #prop (fun h -> B.live h x /\ True)
let app_ctxt = AppCtxt.app_ctxt
let app_loc (x:AppCtxt.app_ctxt) (l:eloc) : eloc =
AppCtxt.properties x;
AppCtxt.loc_of x `loc_union` l
inline_for_extraction
noextract
let input_buffer_t = EverParse3d.InputStream.All.t
inline_for_extraction
let error_handler =
typename:string ->
fieldname:string ->
error_reason:string ->
error_code:U64.t ->
ctxt: app_ctxt ->
sl: input_buffer_t ->
pos: LPE.pos_t ->
Stack unit
(requires fun h ->
I.live sl h /\
true_inv h /\
B.live h ctxt /\
loc_not_unused_in h `loc_includes` app_loc ctxt eloc_none /\
address_liveness_insensitive_locs `loc_includes` app_loc ctxt eloc_none /\
app_loc ctxt eloc_none `loc_disjoint` I.footprint sl /\
U64.v pos <= Seq.length (I.get_read sl h)
)
(ensures fun h0 _ h1 ->
let sl = Ghost.reveal sl in
modifies (app_loc ctxt eloc_none) h0 h1 /\
B.live h1 ctxt /\
true_inv h1)
let action
inv disj l on_success a
= (# [EverParse3d.Util.solve_from_ctx ()] I.extra_t #input_buffer_t) ->
ctxt: app_ctxt ->
error_handler_fn : error_handler ->
sl: input_buffer_t ->
len: I.tlen sl ->
pos: LPE.pos_t ->
posf: LPE.pos_t ->
Stack a
(requires fun h ->
I.live sl h /\
disj /\
inv h /\
B.live h ctxt /\
loc_not_unused_in h `loc_includes` app_loc ctxt l /\
address_liveness_insensitive_locs `loc_includes` app_loc ctxt l /\
app_loc ctxt l `loc_disjoint` I.footprint sl /\
U64.v pos <= U64.v posf /\
U64.v posf == Seq.length (I.get_read sl h)
)
(ensures fun h0 _ h1 ->
let sl = Ghost.reveal sl in
modifies (app_loc ctxt l) h0 h1 /\
B.live h1 ctxt /\
inv h1)
module LP = LowParse.Spec.Base
module LPL = LowParse.Low.Base
unfold
let valid_consumed
(#input_buffer_t: Type0)
(# [tcresolve ()] inst : I.input_stream_inst input_buffer_t)
(#k: LP.parser_kind)
(#t: Type)
(p: LP.parser k t)
(h: HS.mem)
(h': HS.mem)
(sl: input_buffer_t)
: Tot prop
= I.live sl h /\
I.live sl h' /\
begin
let s = I.get_remaining sl h in
begin match LP.parse p s with
| None -> False
| Some (_, len) -> I.get_remaining sl h' `Seq.equal` Seq.slice s len (Seq.length s)
end
end
unfold
let valid_length
(#input_buffer_t: Type0)
(# [tcresolve ()] inst : I.input_stream_inst input_buffer_t)
(#k: LP.parser_kind)
(#t: Type)
(p: LP.parser k t)
(h: HS.mem)
(sl: input_buffer_t)
(len: int)
: Tot prop
= I.live sl h /\
begin
let s = I.get_remaining sl h in
begin match LP.parse p s with
| None -> False
| Some (_, len') -> len == len'
end
end
let valid
(#input_buffer_t: Type0)
(# [tcresolve ()] inst : I.input_stream_inst input_buffer_t)
(#k: LP.parser_kind)
(#t: Type)
(p: LP.parser k t)
(h: HS.mem)
(sl: input_buffer_t)
: Tot prop
= I.live sl h /\
Some? (LP.parse p (I.get_remaining sl h))
inline_for_extraction noextract
let validate_with_action_t'
(#k:LP.parser_kind)
(#t:Type)
(p:LP.parser k t)
(inv:slice_inv)
(disj:disjointness_pre)
(l:eloc)
(allow_reading:bool)
: Type
= (# [EverParse3d.Util.solve_from_ctx ()] I.extra_t #input_buffer_t) ->
(ctxt: app_ctxt) ->
(error_handler_fn : error_handler) ->
(sl: input_buffer_t) ->
(len: I.tlen sl) ->
(pos: LPE.pos_t) ->
Stack U64.t
(requires fun h ->
I.live sl h /\
disj /\
inv h /\
B.live h ctxt /\
loc_not_unused_in h `loc_includes` app_loc ctxt l /\
address_liveness_insensitive_locs `loc_includes` app_loc ctxt l /\
U64.v pos == Seq.length (I.get_read sl h) /\
app_loc ctxt l `loc_disjoint` I.footprint sl
)
(ensures fun h res h' ->
I.live sl h' /\
modifies (app_loc ctxt l `loc_union` I.perm_footprint sl) h h' /\
inv h' /\
B.live h' ctxt /\
(((~ allow_reading) \/ LPE.is_error res) ==> U64.v (LPE.get_validator_error_pos res) == Seq.length (I.get_read sl h')) /\
begin let s = I.get_remaining sl h in
if LPE.is_success res
then
begin if allow_reading
then U64.v res >= U64.v pos /\ valid_length p h sl (U64.v res - U64.v pos) /\ I.get_remaining sl h' == s
else valid_consumed p h h' sl
end
else
let s' = I.get_remaining sl h' in
(LPE.get_validator_error_kind res <> LPE.get_validator_error_kind LPE.validator_error_action_failed ==> None? (LP.parse p s)) /\
Seq.length s' <= Seq.length s /\
s' `Seq.equal` Seq.slice s (Seq.length s - Seq.length s') (Seq.length s)
end
)
let validate_with_action_t p inv disj l allow_reading = validate_with_action_t' p inv disj l allow_reading | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Comment.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"LowParse.Low.ListUpTo.fst.checked",
"LowParse.Low.Int.fsti.checked",
"LowParse.Low.FLData.fst.checked",
"LowParse.Low.BoundedInt.fsti.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.PredicateExtensionality.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Classical.fsti.checked",
"EverParse3d.Util.fst.checked",
"EverParse3d.Prelude.fst.checked",
"EverParse3d.Kinds.fst.checked",
"EverParse3d.InputStream.Base.fst.checked",
"EverParse3d.InputStream.All.fsti.checked",
"EverParse3d.ErrorCode.fst.checked",
"EverParse3d.CopyBuffer.fsti.checked",
"EverParse3d.AppCtxt.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Actions.Base.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Low.Base",
"short_module": "LPL"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "EverParse3d.Prelude",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.ErrorCode",
"short_module": "LPE"
},
{
"abbrev": true,
"full_module": "EverParse3d.AppCtxt",
"short_module": "AppCtxt"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "EverParse3d.InputStream.Base",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverParse3d.CopyBuffer",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "EverParse3d.Prelude",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d.Actions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | v: EverParse3d.Actions.Base.validate_with_action_t p inv disj l allow_reading
-> EverParse3d.Actions.Base.validate_with_action_t p inv disj l allow_reading | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"EverParse3d.Kinds.weak_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Prelude.parser",
"EverParse3d.Actions.Base.slice_inv",
"EverParse3d.Actions.Base.disjointness_pre",
"EverParse3d.Actions.Base.eloc",
"EverParse3d.Actions.Base.validate_with_action_t",
"EverParse3d.InputStream.Base.extra_t",
"EverParse3d.Actions.Base.input_buffer_t",
"EverParse3d.InputStream.All.inst",
"EverParse3d.Actions.Base.app_ctxt",
"EverParse3d.Actions.Base.error_handler",
"EverParse3d.InputStream.Base.tlen",
"EverParse3d.ErrorCode.pos_t",
"FStar.UInt64.t",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"EverParse3d.InputStream.Base.live",
"LowStar.Monotonic.Buffer.live",
"FStar.UInt8.t",
"LowStar.Buffer.trivial_preorder",
"LowStar.Monotonic.Buffer.loc_includes",
"LowStar.Monotonic.Buffer.loc_not_unused_in",
"FStar.Ghost.reveal",
"LowStar.Monotonic.Buffer.loc",
"EverParse3d.Actions.Base.app_loc",
"LowStar.Monotonic.Buffer.address_liveness_insensitive_locs",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt64.n",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.UInt64.v",
"FStar.Seq.Base.length",
"EverParse3d.InputStream.Base.get_read",
"LowStar.Monotonic.Buffer.loc_disjoint",
"EverParse3d.InputStream.Base.footprint",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_union",
"EverParse3d.InputStream.Base.perm_footprint",
"Prims.l_imp",
"Prims.l_not",
"EverParse3d.ErrorCode.is_error",
"EverParse3d.ErrorCode.get_validator_error_pos",
"EverParse3d.ErrorCode.is_success",
"EverParse3d.Actions.Base.valid_length",
"Prims.op_Subtraction",
"FStar.Seq.Base.seq",
"EverParse3d.InputStream.Base.get_remaining",
"EverParse3d.Actions.Base.valid_consumed",
"Prims.logical",
"Prims.op_disEquality",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"EverParse3d.ErrorCode.get_validator_error_kind",
"EverParse3d.ErrorCode.validator_error_action_failed",
"FStar.Pervasives.Native.uu___is_None",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Base.parse",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.slice"
] | [] | false | false | false | false | false | let validate_eta v =
| fun ctxt error_handler_fn sl pos -> v ctxt error_handler_fn sl pos | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.