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
Vale.AES.OptPublic_BE.fst
Vale.AES.OptPublic_BE.shift_gf128_key_1
val shift_gf128_key_1 (h: poly) : poly
val shift_gf128_key_1 (h: poly) : poly
let shift_gf128_key_1 (h:poly) : poly = shift_key_1 128 gf128_modulus_low_terms h
{ "file_name": "vale/code/crypto/aes/Vale.AES.OptPublic_BE.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 43, "end_line": 13, "start_col": 0, "start_line": 12 }
module Vale.AES.OptPublic_BE open FStar.Mul open FStar.Seq open Vale.Def.Types_s open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.Def.Words_s
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.OptPublic_BE.fst" }
[ { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.Math.Poly2_s.poly -> Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2_s.poly", "Vale.AES.GF128.shift_key_1", "Vale.AES.GF128_s.gf128_modulus_low_terms" ]
[]
false
false
false
true
false
let shift_gf128_key_1 (h: poly) : poly =
shift_key_1 128 gf128_modulus_low_terms h
false
Vale.AES.OptPublic_BE.fst
Vale.AES.OptPublic_BE.gf128_power
val gf128_power (h: poly) (n: nat) : poly
val gf128_power (h: poly) (n: nat) : poly
let gf128_power (h:poly) (n:nat) : poly = shift_gf128_key_1 (g_power h n)
{ "file_name": "vale/code/crypto/aes/Vale.AES.OptPublic_BE.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 73, "end_line": 20, "start_col": 0, "start_line": 20 }
module Vale.AES.OptPublic_BE open FStar.Mul open FStar.Seq open Vale.Def.Types_s open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.Def.Words_s let shift_gf128_key_1 (h:poly) : poly = shift_key_1 128 gf128_modulus_low_terms h let rec g_power (a:poly) (n:nat) : poly = if n = 0 then zero else // arbitrary value for n = 0 if n = 1 then a else a *~ g_power a (n - 1)
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.OptPublic_BE.fst" }
[ { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.Math.Poly2_s.poly -> n: Prims.nat -> Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2_s.poly", "Prims.nat", "Vale.AES.OptPublic_BE.shift_gf128_key_1", "Vale.AES.OptPublic_BE.g_power" ]
[]
false
false
false
true
false
let gf128_power (h: poly) (n: nat) : poly =
shift_gf128_key_1 (g_power h n)
false
Vale.AES.OptPublic_BE.fst
Vale.AES.OptPublic_BE.g_power
val g_power (a: poly) (n: nat) : poly
val g_power (a: poly) (n: nat) : poly
let rec g_power (a:poly) (n:nat) : poly = if n = 0 then zero else // arbitrary value for n = 0 if n = 1 then a else a *~ g_power a (n - 1)
{ "file_name": "vale/code/crypto/aes/Vale.AES.OptPublic_BE.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 24, "end_line": 18, "start_col": 0, "start_line": 15 }
module Vale.AES.OptPublic_BE open FStar.Mul open FStar.Seq open Vale.Def.Types_s open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.Def.Words_s let shift_gf128_key_1 (h:poly) : poly = shift_key_1 128 gf128_modulus_low_terms h
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.OptPublic_BE.fst" }
[ { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2_s.poly -> n: Prims.nat -> Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2_s.poly", "Prims.nat", "Prims.op_Equality", "Prims.int", "Vale.Math.Poly2_s.zero", "Prims.bool", "Vale.AES.GF128.op_Star_Tilde", "Vale.AES.OptPublic_BE.g_power", "Prims.op_Subtraction" ]
[ "recursion" ]
false
false
false
true
false
let rec g_power (a: poly) (n: nat) : poly =
if n = 0 then zero else if n = 1 then a else a *~ g_power a (n - 1)
false
Vale.AES.OptPublic_BE.fst
Vale.AES.OptPublic_BE.hkeys_reqs_pub
val hkeys_reqs_pub (hkeys:FStar.Seq.seq quad32) (h_BE:quad32) : Vale.Def.Prop_s.prop0
val hkeys_reqs_pub (hkeys:FStar.Seq.seq quad32) (h_BE:quad32) : Vale.Def.Prop_s.prop0
let hkeys_reqs_pub (hkeys:seq quad32) (h_BE:quad32) : Vale.Def.Prop_s.prop0 = let h = of_quad32 h_BE in length hkeys >= 3 /\ of_quad32 (index hkeys 0) == gf128_power h 1 /\ of_quad32 (index hkeys 1) == gf128_power h 2 /\ index hkeys 2 == h_BE
{ "file_name": "vale/code/crypto/aes/Vale.AES.OptPublic_BE.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 28, "start_col": 0, "start_line": 22 }
module Vale.AES.OptPublic_BE open FStar.Mul open FStar.Seq open Vale.Def.Types_s open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.Def.Words_s let shift_gf128_key_1 (h:poly) : poly = shift_key_1 128 gf128_modulus_low_terms h let rec g_power (a:poly) (n:nat) : poly = if n = 0 then zero else // arbitrary value for n = 0 if n = 1 then a else a *~ g_power a (n - 1) let gf128_power (h:poly) (n:nat) : poly = shift_gf128_key_1 (g_power h n)
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.OptPublic_BE.fst" }
[ { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
hkeys: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 -> h_BE: Vale.Def.Types_s.quad32 -> Vale.Def.Prop_s.prop0
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.seq", "Vale.Def.Types_s.quad32", "Prims.l_and", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.Seq.Base.length", "Prims.eq2", "Vale.Math.Poly2_s.poly", "Vale.Math.Poly2.Bits_s.of_quad32", "FStar.Seq.Base.index", "Vale.AES.OptPublic_BE.gf128_power", "Vale.Def.Prop_s.prop0" ]
[]
false
false
false
true
false
let hkeys_reqs_pub (hkeys: seq quad32) (h_BE: quad32) : Vale.Def.Prop_s.prop0 =
let h = of_quad32 h_BE in length hkeys >= 3 /\ of_quad32 (index hkeys 0) == gf128_power h 1 /\ of_quad32 (index hkeys 1) == gf128_power h 2 /\ index hkeys 2 == h_BE
false
EverParse3d.Readable.fsti
EverParse3d.Readable.perm
val perm : b: LowStar.Buffer.buffer t -> Type0
let perm (#t: Type) (b: B.buffer t) = (x: perm0 t { perm_prop x b })
{ "file_name": "src/3d/prelude/buffer/EverParse3d.Readable.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 68, "end_line": 16, "start_col": 0, "start_line": 16 }
module EverParse3d.Readable module B = LowStar.Buffer module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module U32 = FStar.UInt32 module LPL = LowParse.Low.Base // not erasable because Low* buffers of erased elements are not erasable inline_for_extraction noextract val perm0 (t: Type) : Tot Type0 val perm_prop (#t: Type) (x: perm0 t) (b: B.buffer t) : Tot prop
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "EverParse3d.Readable.fsti" }
[ { "abbrev": true, "full_module": "LowParse.Low.Base", "short_module": "LPL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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=100" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 8, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: LowStar.Buffer.buffer t -> Type0
Prims.Tot
[ "total" ]
[]
[ "LowStar.Buffer.buffer", "EverParse3d.Readable.perm0", "EverParse3d.Readable.perm_prop" ]
[]
false
false
false
true
true
let perm (#t: Type) (b: B.buffer t) =
(x: perm0 t {perm_prop x b})
false
Spec.Frodo.Lemmas.fst
Spec.Frodo.Lemmas.lognot_plus_one
val lognot_plus_one: e:uint16 -> Lemma (v (lognot e) == modulus U16 - v e - 1)
val lognot_plus_one: e:uint16 -> Lemma (v (lognot e) == modulus U16 - v e - 1)
let lognot_plus_one e = lognot_spec e; assert (v (lognot e) == UInt.lognot #16 (v e)); UInt.lemma_lognot_value_mod #16 (v e); assert (v (lognot e) == pow2 16 - v e - 1)
{ "file_name": "specs/frodo/Spec.Frodo.Lemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 44, "end_line": 58, "start_col": 0, "start_line": 54 }
module Spec.Frodo.Lemmas open FStar.Mul open Lib.IntTypes #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_mask_cast: mask:uint16{v mask = 0 \/ v mask = v (ones U16 SEC)} -> Lemma ((v mask = 0 ==> v (to_u8 mask) = 0) /\ (v mask = v (ones U16 SEC) ==> v (to_u8 mask) = v (ones U8 SEC))) let lemma_mask_cast mask = () // To avoid integral promotion, a cast to uint_16 is needed // https://en.cppreference.com/w/cpp/language/operator_arithmetic val lemma_frodo_sample: a:uint16{v a < pow2 15} -> b:uint16{v b < pow2 15} -> Lemma (let c0 = if v a > v b then 1 else 0 in let c1 = to_u16 (to_u32 (b -. a)) >>. 15ul in v c1 == c0) let lemma_frodo_sample a b = let c = to_u16 (to_u32 (b -. a)) in assert (v c < modulus U16); Math.Lemmas.lemma_div_lt (uint_v c) 16 15; let c1 = c >>. 15ul in assert (v c1 = v c / pow2 15); Math.Lemmas.pow2_minus 16 15; assert (v c1 = 0 \/ v c1 = 1) val modulo_pow2_u16: a:uint16 -> b:size_nat{b < 16} -> Lemma (v a % pow2 b == v (a &. ((u16 1 <<. size b) -. u16 1))) let modulo_pow2_u16 a b = Math.Lemmas.pow2_lt_compat 16 b; mod_mask_lemma #U16 a (size b); assert (v (mod_mask #U16 #SEC (size b)) == v ((u16 1 <<. size b) -. u16 1)) val modulo_pow2_u64: a:uint64 -> b:size_nat{b < 64} -> Lemma (v a % pow2 b == v (a &. ((u64 1 <<. size b) -. u64 1))) let modulo_pow2_u64 a b = Math.Lemmas.pow2_lt_compat 64 b; mod_mask_lemma #U64 a (size b); assert (v (mod_mask #U64 #SEC (size b)) == v ((u64 1 <<. size b) -. u64 1)) val lognot_plus_one:
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Spec.Frodo.Lemmas.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
e: Lib.IntTypes.uint16 -> FStar.Pervasives.Lemma (ensures Lib.IntTypes.v (Lib.IntTypes.lognot e) == Lib.IntTypes.modulus Lib.IntTypes.U16 - Lib.IntTypes.v e - 1)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Lib.IntTypes.uint16", "Prims._assert", "Prims.eq2", "Prims.int", "Lib.IntTypes.v", "Lib.IntTypes.U16", "Lib.IntTypes.SEC", "Lib.IntTypes.lognot", "Prims.op_Subtraction", "Prims.pow2", "Prims.unit", "FStar.UInt.lemma_lognot_value_mod", "Prims.l_or", "Lib.IntTypes.range", "FStar.UInt.size", "FStar.UInt.lognot", "Lib.IntTypes.lognot_spec" ]
[]
true
false
true
false
false
let lognot_plus_one e =
lognot_spec e; assert (v (lognot e) == UInt.lognot #16 (v e)); UInt.lemma_lognot_value_mod #16 (v e); assert (v (lognot e) == pow2 16 - v e - 1)
false
Spec.Frodo.Lemmas.fst
Spec.Frodo.Lemmas.lemma_frodo_sample
val lemma_frodo_sample: a:uint16{v a < pow2 15} -> b:uint16{v b < pow2 15} -> Lemma (let c0 = if v a > v b then 1 else 0 in let c1 = to_u16 (to_u32 (b -. a)) >>. 15ul in v c1 == c0)
val lemma_frodo_sample: a:uint16{v a < pow2 15} -> b:uint16{v b < pow2 15} -> Lemma (let c0 = if v a > v b then 1 else 0 in let c1 = to_u16 (to_u32 (b -. a)) >>. 15ul in v c1 == c0)
let lemma_frodo_sample a b = let c = to_u16 (to_u32 (b -. a)) in assert (v c < modulus U16); Math.Lemmas.lemma_div_lt (uint_v c) 16 15; let c1 = c >>. 15ul in assert (v c1 = v c / pow2 15); Math.Lemmas.pow2_minus 16 15; assert (v c1 = 0 \/ v c1 = 1)
{ "file_name": "specs/frodo/Spec.Frodo.Lemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 31, "start_col": 0, "start_line": 24 }
module Spec.Frodo.Lemmas open FStar.Mul open Lib.IntTypes #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_mask_cast: mask:uint16{v mask = 0 \/ v mask = v (ones U16 SEC)} -> Lemma ((v mask = 0 ==> v (to_u8 mask) = 0) /\ (v mask = v (ones U16 SEC) ==> v (to_u8 mask) = v (ones U8 SEC))) let lemma_mask_cast mask = () // To avoid integral promotion, a cast to uint_16 is needed // https://en.cppreference.com/w/cpp/language/operator_arithmetic val lemma_frodo_sample: a:uint16{v a < pow2 15} -> b:uint16{v b < pow2 15} -> Lemma (let c0 = if v a > v b then 1 else 0 in let c1 = to_u16 (to_u32 (b -. a)) >>. 15ul in v c1 == c0)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Spec.Frodo.Lemmas.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
a: Lib.IntTypes.uint16{Lib.IntTypes.v a < Prims.pow2 15} -> b: Lib.IntTypes.uint16{Lib.IntTypes.v b < Prims.pow2 15} -> FStar.Pervasives.Lemma (ensures (let c0 = (match Lib.IntTypes.v a > Lib.IntTypes.v b with | true -> 1 | _ -> 0) <: Prims.int in let c1 = Lib.IntTypes.to_u16 (Lib.IntTypes.to_u32 (b -. a)) >>. 15ul in Lib.IntTypes.v c1 == c0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Lib.IntTypes.uint16", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U16", "Lib.IntTypes.SEC", "Prims.pow2", "Prims._assert", "Prims.l_or", "Prims.op_Equality", "Prims.int", "Prims.unit", "FStar.Math.Lemmas.pow2_minus", "Prims.op_Division", "Lib.IntTypes.int_t", "Lib.IntTypes.op_Greater_Greater_Dot", "FStar.UInt32.__uint_to_t", "FStar.Math.Lemmas.lemma_div_lt", "Lib.IntTypes.uint_v", "Lib.IntTypes.modulus", "Lib.IntTypes.to_u16", "Lib.IntTypes.U32", "Lib.IntTypes.to_u32", "Lib.IntTypes.op_Subtraction_Dot" ]
[]
true
false
true
false
false
let lemma_frodo_sample a b =
let c = to_u16 (to_u32 (b -. a)) in assert (v c < modulus U16); Math.Lemmas.lemma_div_lt (uint_v c) 16 15; let c1 = c >>. 15ul in assert (v c1 = v c / pow2 15); Math.Lemmas.pow2_minus 16 15; assert (v c1 = 0 \/ v c1 = 1)
false
Spec.Frodo.Lemmas.fst
Spec.Frodo.Lemmas.modulo_pow2_u16
val modulo_pow2_u16: a:uint16 -> b:size_nat{b < 16} -> Lemma (v a % pow2 b == v (a &. ((u16 1 <<. size b) -. u16 1)))
val modulo_pow2_u16: a:uint16 -> b:size_nat{b < 16} -> Lemma (v a % pow2 b == v (a &. ((u16 1 <<. size b) -. u16 1)))
let modulo_pow2_u16 a b = Math.Lemmas.pow2_lt_compat 16 b; mod_mask_lemma #U16 a (size b); assert (v (mod_mask #U16 #SEC (size b)) == v ((u16 1 <<. size b) -. u16 1))
{ "file_name": "specs/frodo/Spec.Frodo.Lemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 77, "end_line": 40, "start_col": 0, "start_line": 37 }
module Spec.Frodo.Lemmas open FStar.Mul open Lib.IntTypes #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_mask_cast: mask:uint16{v mask = 0 \/ v mask = v (ones U16 SEC)} -> Lemma ((v mask = 0 ==> v (to_u8 mask) = 0) /\ (v mask = v (ones U16 SEC) ==> v (to_u8 mask) = v (ones U8 SEC))) let lemma_mask_cast mask = () // To avoid integral promotion, a cast to uint_16 is needed // https://en.cppreference.com/w/cpp/language/operator_arithmetic val lemma_frodo_sample: a:uint16{v a < pow2 15} -> b:uint16{v b < pow2 15} -> Lemma (let c0 = if v a > v b then 1 else 0 in let c1 = to_u16 (to_u32 (b -. a)) >>. 15ul in v c1 == c0) let lemma_frodo_sample a b = let c = to_u16 (to_u32 (b -. a)) in assert (v c < modulus U16); Math.Lemmas.lemma_div_lt (uint_v c) 16 15; let c1 = c >>. 15ul in assert (v c1 = v c / pow2 15); Math.Lemmas.pow2_minus 16 15; assert (v c1 = 0 \/ v c1 = 1) val modulo_pow2_u16: a:uint16 -> b:size_nat{b < 16} -> Lemma
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Spec.Frodo.Lemmas.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
a: Lib.IntTypes.uint16 -> b: Lib.IntTypes.size_nat{b < 16} -> FStar.Pervasives.Lemma (ensures Lib.IntTypes.v a % Prims.pow2 b == Lib.IntTypes.v (a &. (Lib.IntTypes.u16 1 <<. Lib.IntTypes.size b) -. Lib.IntTypes.u16 1))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Lib.IntTypes.uint16", "Lib.IntTypes.size_nat", "Prims.b2t", "Prims.op_LessThan", "Prims._assert", "Prims.eq2", "Lib.IntTypes.range_t", "Lib.IntTypes.U16", "Lib.IntTypes.v", "Lib.IntTypes.SEC", "Lib.IntTypes.mod_mask", "Lib.IntTypes.size", "Lib.IntTypes.op_Subtraction_Dot", "Lib.IntTypes.op_Less_Less_Dot", "Lib.IntTypes.u16", "Prims.unit", "Lib.IntTypes.mod_mask_lemma", "FStar.Math.Lemmas.pow2_lt_compat" ]
[]
true
false
true
false
false
let modulo_pow2_u16 a b =
Math.Lemmas.pow2_lt_compat 16 b; mod_mask_lemma #U16 a (size b); assert (v (mod_mask #U16 #SEC (size b)) == v ((u16 1 <<. size b) -. u16 1))
false
Spec.Frodo.Lemmas.fst
Spec.Frodo.Lemmas.lemma_matrix_index_repeati2
val lemma_matrix_index_repeati2: n1:size_nat -> n2:size_nat -> i:size_nat{i < n1} -> j:size_nat{j < n2} -> Lemma (2 * (n1 * j + i) + 2 <= 2 * n1 * n2)
val lemma_matrix_index_repeati2: n1:size_nat -> n2:size_nat -> i:size_nat{i < n1} -> j:size_nat{j < n2} -> Lemma (2 * (n1 * j + i) + 2 <= 2 * n1 * n2)
let lemma_matrix_index_repeati2 n1 n2 i j = lemma_matrix_index_repeati1 n2 n1 j i
{ "file_name": "specs/frodo/Spec.Frodo.Lemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 39, "end_line": 130, "start_col": 0, "start_line": 129 }
module Spec.Frodo.Lemmas open FStar.Mul open Lib.IntTypes #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_mask_cast: mask:uint16{v mask = 0 \/ v mask = v (ones U16 SEC)} -> Lemma ((v mask = 0 ==> v (to_u8 mask) = 0) /\ (v mask = v (ones U16 SEC) ==> v (to_u8 mask) = v (ones U8 SEC))) let lemma_mask_cast mask = () // To avoid integral promotion, a cast to uint_16 is needed // https://en.cppreference.com/w/cpp/language/operator_arithmetic val lemma_frodo_sample: a:uint16{v a < pow2 15} -> b:uint16{v b < pow2 15} -> Lemma (let c0 = if v a > v b then 1 else 0 in let c1 = to_u16 (to_u32 (b -. a)) >>. 15ul in v c1 == c0) let lemma_frodo_sample a b = let c = to_u16 (to_u32 (b -. a)) in assert (v c < modulus U16); Math.Lemmas.lemma_div_lt (uint_v c) 16 15; let c1 = c >>. 15ul in assert (v c1 = v c / pow2 15); Math.Lemmas.pow2_minus 16 15; assert (v c1 = 0 \/ v c1 = 1) val modulo_pow2_u16: a:uint16 -> b:size_nat{b < 16} -> Lemma (v a % pow2 b == v (a &. ((u16 1 <<. size b) -. u16 1))) let modulo_pow2_u16 a b = Math.Lemmas.pow2_lt_compat 16 b; mod_mask_lemma #U16 a (size b); assert (v (mod_mask #U16 #SEC (size b)) == v ((u16 1 <<. size b) -. u16 1)) val modulo_pow2_u64: a:uint64 -> b:size_nat{b < 64} -> Lemma (v a % pow2 b == v (a &. ((u64 1 <<. size b) -. u64 1))) let modulo_pow2_u64 a b = Math.Lemmas.pow2_lt_compat 64 b; mod_mask_lemma #U64 a (size b); assert (v (mod_mask #U64 #SEC (size b)) == v ((u64 1 <<. size b) -. u64 1)) val lognot_plus_one: e:uint16 -> Lemma (v (lognot e) == modulus U16 - v e - 1) let lognot_plus_one e = lognot_spec e; assert (v (lognot e) == UInt.lognot #16 (v e)); UInt.lemma_lognot_value_mod #16 (v e); assert (v (lognot e) == pow2 16 - v e - 1) val lemma_frodo_sample2: sign:uint16{v sign <= 1} -> e:uint16 -> Lemma (((lognot sign +. u16 1) ^. e) +. sign == u16 ((Math.Lib.powx (-1) (v sign) * v e) % modulus U16)) let lemma_frodo_sample2 sign e = calc (==) { v ((lognot sign +. u16 1) ^. e); (==) { logxor_spec (lognot sign +. u16 1) e } logxor_v #U16 (v (lognot sign +. u16 1)) (v e); (==) { lognot_plus_one sign } logxor_v #U16 ((modulus U16 - v sign) % modulus U16) (v e); (==) { UInt.logxor_commutative #16 ((modulus U16 - v sign) % modulus U16) (v e) } logxor_v #U16 (v e) ((modulus U16 - v sign) % modulus U16); }; if v sign = 0 then begin calc (==) { logxor_v #U16 (v e) ((modulus U16 - v sign) % modulus U16); (==) { Math.Lemmas.multiple_modulo_lemma 1 (modulus U16) } logxor_v #U16 (v e) 0; (==) { UInt.logxor_lemma_1 #16 (v e) } v e; }; assert (v (((lognot sign +. u16 1) ^. e) +. sign) == v e); assert_norm (Math.Lib.powx (-1) 0 = 1); Math.Lemmas.small_mod (v e) (modulus U16) end else begin calc (==) { logxor_v #U16 (v e) ((modulus U16 - v sign) % modulus U16); (==) { Math.Lemmas.small_mod (modulus U16 - v sign) (modulus U16) } logxor_v #U16 (v e) (UInt.ones 16); (==) { UInt.logxor_lemma_2 #16 (v e) } lognot_v #U16 (v e); (==) { UInt.lemma_lognot_value_mod #16 (v e) } modulus U16 - v e - 1; }; assert (v (((lognot sign +. u16 1) ^. e) +. sign) == (modulus U16 - v e) % modulus U16); assert_norm (Math.Lib.powx (-1) 1 = -1) end val lemma_mul_acc_comm: a:size_nat -> b:size_nat -> c:size_nat -> Lemma (a * b * c = c * a * b) let lemma_mul_acc_comm a b c = () val lemma_matrix_index_repeati1: n1:size_nat -> n2:size_nat -> i:size_nat{i < n1} -> j:size_nat{j < n2} -> Lemma (2 * (i * n2 + j) + 2 <= 2 * n1 * n2) let lemma_matrix_index_repeati1 n1 n2 i j = assert (i * n2 + j <= (n1 - 1) * n2 + (n2 - 1)); calc (<=) { 2 * (i * n2 + j) + 2; <= { Math.Lemmas.lemma_mult_le_right n2 i (n1 - 1) } 2 * ((n1 - 1) * n2 + (n2 - 1)) + 2; == { } 2 * (n1 - 1) * n2 + 2 * n2 - 2 + 2; == { } 2 * n1 * n2; } val lemma_matrix_index_repeati2: n1:size_nat -> n2:size_nat -> i:size_nat{i < n1} -> j:size_nat{j < n2} -> Lemma (2 * (n1 * j + i) + 2 <= 2 * n1 * n2)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Spec.Frodo.Lemmas.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
n1: Lib.IntTypes.size_nat -> n2: Lib.IntTypes.size_nat -> i: Lib.IntTypes.size_nat{i < n1} -> j: Lib.IntTypes.size_nat{j < n2} -> FStar.Pervasives.Lemma (ensures 2 * (n1 * j + i) + 2 <= (2 * n1) * n2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Lib.IntTypes.size_nat", "Prims.b2t", "Prims.op_LessThan", "Spec.Frodo.Lemmas.lemma_matrix_index_repeati1", "Prims.unit" ]
[]
true
false
true
false
false
let lemma_matrix_index_repeati2 n1 n2 i j =
lemma_matrix_index_repeati1 n2 n1 j i
false
Spec.Frodo.Lemmas.fst
Spec.Frodo.Lemmas.modulo_pow2_u64
val modulo_pow2_u64: a:uint64 -> b:size_nat{b < 64} -> Lemma (v a % pow2 b == v (a &. ((u64 1 <<. size b) -. u64 1)))
val modulo_pow2_u64: a:uint64 -> b:size_nat{b < 64} -> Lemma (v a % pow2 b == v (a &. ((u64 1 <<. size b) -. u64 1)))
let modulo_pow2_u64 a b = Math.Lemmas.pow2_lt_compat 64 b; mod_mask_lemma #U64 a (size b); assert (v (mod_mask #U64 #SEC (size b)) == v ((u64 1 <<. size b) -. u64 1))
{ "file_name": "specs/frodo/Spec.Frodo.Lemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 77, "end_line": 49, "start_col": 0, "start_line": 46 }
module Spec.Frodo.Lemmas open FStar.Mul open Lib.IntTypes #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_mask_cast: mask:uint16{v mask = 0 \/ v mask = v (ones U16 SEC)} -> Lemma ((v mask = 0 ==> v (to_u8 mask) = 0) /\ (v mask = v (ones U16 SEC) ==> v (to_u8 mask) = v (ones U8 SEC))) let lemma_mask_cast mask = () // To avoid integral promotion, a cast to uint_16 is needed // https://en.cppreference.com/w/cpp/language/operator_arithmetic val lemma_frodo_sample: a:uint16{v a < pow2 15} -> b:uint16{v b < pow2 15} -> Lemma (let c0 = if v a > v b then 1 else 0 in let c1 = to_u16 (to_u32 (b -. a)) >>. 15ul in v c1 == c0) let lemma_frodo_sample a b = let c = to_u16 (to_u32 (b -. a)) in assert (v c < modulus U16); Math.Lemmas.lemma_div_lt (uint_v c) 16 15; let c1 = c >>. 15ul in assert (v c1 = v c / pow2 15); Math.Lemmas.pow2_minus 16 15; assert (v c1 = 0 \/ v c1 = 1) val modulo_pow2_u16: a:uint16 -> b:size_nat{b < 16} -> Lemma (v a % pow2 b == v (a &. ((u16 1 <<. size b) -. u16 1))) let modulo_pow2_u16 a b = Math.Lemmas.pow2_lt_compat 16 b; mod_mask_lemma #U16 a (size b); assert (v (mod_mask #U16 #SEC (size b)) == v ((u16 1 <<. size b) -. u16 1)) val modulo_pow2_u64: a:uint64 -> b:size_nat{b < 64} -> Lemma
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Spec.Frodo.Lemmas.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
a: Lib.IntTypes.uint64 -> b: Lib.IntTypes.size_nat{b < 64} -> FStar.Pervasives.Lemma (ensures Lib.IntTypes.v a % Prims.pow2 b == Lib.IntTypes.v (a &. (Lib.IntTypes.u64 1 <<. Lib.IntTypes.size b) -. Lib.IntTypes.u64 1))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Lib.IntTypes.uint64", "Lib.IntTypes.size_nat", "Prims.b2t", "Prims.op_LessThan", "Prims._assert", "Prims.eq2", "Lib.IntTypes.range_t", "Lib.IntTypes.U64", "Lib.IntTypes.v", "Lib.IntTypes.SEC", "Lib.IntTypes.mod_mask", "Lib.IntTypes.size", "Lib.IntTypes.op_Subtraction_Dot", "Lib.IntTypes.op_Less_Less_Dot", "Lib.IntTypes.u64", "Prims.unit", "Lib.IntTypes.mod_mask_lemma", "FStar.Math.Lemmas.pow2_lt_compat" ]
[]
true
false
true
false
false
let modulo_pow2_u64 a b =
Math.Lemmas.pow2_lt_compat 64 b; mod_mask_lemma #U64 a (size b); assert (v (mod_mask #U64 #SEC (size b)) == v ((u64 1 <<. size b) -. u64 1))
false
EverParse3d.Readable.fsti
EverParse3d.Readable.readable_split'
val readable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (readable h p from to)) (ensures (readable h p from mid /\ readable h p mid to))
val readable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (readable h p from to)) (ensures (readable h p from mid /\ readable h p mid to))
let readable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (readable h p from mid /\ readable h p mid to)) = readable_split h p from mid to
{ "file_name": "src/3d/prelude/buffer/EverParse3d.Readable.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 32, "end_line": 148, "start_col": 0, "start_line": 139 }
module EverParse3d.Readable module B = LowStar.Buffer module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module U32 = FStar.UInt32 module LPL = LowParse.Low.Base // not erasable because Low* buffers of erased elements are not erasable inline_for_extraction noextract val perm0 (t: Type) : Tot Type0 val perm_prop (#t: Type) (x: perm0 t) (b: B.buffer t) : Tot prop inline_for_extraction noextract let perm (#t: Type) (b: B.buffer t) = (x: perm0 t { perm_prop x b }) val loc_perm (#t: _) (#b: B.buffer t) (p: perm b) : GTot B.loc val loc_perm_prop (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (B.address_liveness_insensitive_locs `B.loc_includes` loc_perm p) [SMTPat (loc_perm p)] val valid_perm (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : GTot Type0 val valid_perm_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (requires (valid_perm h p)) (ensures ( B.live h b /\ B.loc_buffer b `B.loc_disjoint` loc_perm p /\ loc_perm p `B.loc_in` h )) [SMTPat (valid_perm h p)] val preserved (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Tot prop val valid_perm_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) let valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) [SMTPatOr [ [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h p) ] ; [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p) ] ; ]] = valid_perm_frame h p l h' val preserved_refl (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h: HS.mem) : Lemma (preserved p from to h h) val preserved_trans (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h1 h2 h3: HS.mem) : Lemma (requires ( preserved p from to h1 h2 /\ preserved p from to h2 h3 )) (ensures ( preserved p from to h1 h3 )) val preserved_split (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Lemma (preserved p from to h h' <==> (preserved p from mid h h' /\ preserved p mid to h h')) val readable (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : GTot Type0 val readable_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (valid_perm h p)) [SMTPat (readable h p from to)] val readable_split (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (readable h p from to <==> (readable h p from mid /\ readable h p mid to))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "EverParse3d.Readable.fsti" }
[ { "abbrev": true, "full_module": "LowParse.Low.Base", "short_module": "LPL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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=100" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 8, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> p: EverParse3d.Readable.perm b -> from: FStar.UInt32.t -> mid: FStar.UInt32.t -> to: FStar.UInt32.t { FStar.UInt32.v from <= FStar.UInt32.v mid /\ FStar.UInt32.v mid <= FStar.UInt32.v to /\ FStar.UInt32.v to <= LowStar.Monotonic.Buffer.length b } -> FStar.Pervasives.Lemma (requires EverParse3d.Readable.readable h p from to) (ensures EverParse3d.Readable.readable h p from mid /\ EverParse3d.Readable.readable h p mid to)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Monotonic.HyperStack.mem", "LowStar.Buffer.buffer", "EverParse3d.Readable.perm", "FStar.UInt32.t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "EverParse3d.Readable.readable_split", "Prims.unit", "EverParse3d.Readable.readable", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let readable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (readable h p from to)) (ensures (readable h p from mid /\ readable h p mid to)) =
readable_split h p from mid to
false
Spec.Frodo.Lemmas.fst
Spec.Frodo.Lemmas.lemma_matrix_index_repeati1
val lemma_matrix_index_repeati1: n1:size_nat -> n2:size_nat -> i:size_nat{i < n1} -> j:size_nat{j < n2} -> Lemma (2 * (i * n2 + j) + 2 <= 2 * n1 * n2)
val lemma_matrix_index_repeati1: n1:size_nat -> n2:size_nat -> i:size_nat{i < n1} -> j:size_nat{j < n2} -> Lemma (2 * (i * n2 + j) + 2 <= 2 * n1 * n2)
let lemma_matrix_index_repeati1 n1 n2 i j = assert (i * n2 + j <= (n1 - 1) * n2 + (n2 - 1)); calc (<=) { 2 * (i * n2 + j) + 2; <= { Math.Lemmas.lemma_mult_le_right n2 i (n1 - 1) } 2 * ((n1 - 1) * n2 + (n2 - 1)) + 2; == { } 2 * (n1 - 1) * n2 + 2 * n2 - 2 + 2; == { } 2 * n1 * n2; }
{ "file_name": "specs/frodo/Spec.Frodo.Lemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 122, "start_col": 0, "start_line": 112 }
module Spec.Frodo.Lemmas open FStar.Mul open Lib.IntTypes #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_mask_cast: mask:uint16{v mask = 0 \/ v mask = v (ones U16 SEC)} -> Lemma ((v mask = 0 ==> v (to_u8 mask) = 0) /\ (v mask = v (ones U16 SEC) ==> v (to_u8 mask) = v (ones U8 SEC))) let lemma_mask_cast mask = () // To avoid integral promotion, a cast to uint_16 is needed // https://en.cppreference.com/w/cpp/language/operator_arithmetic val lemma_frodo_sample: a:uint16{v a < pow2 15} -> b:uint16{v b < pow2 15} -> Lemma (let c0 = if v a > v b then 1 else 0 in let c1 = to_u16 (to_u32 (b -. a)) >>. 15ul in v c1 == c0) let lemma_frodo_sample a b = let c = to_u16 (to_u32 (b -. a)) in assert (v c < modulus U16); Math.Lemmas.lemma_div_lt (uint_v c) 16 15; let c1 = c >>. 15ul in assert (v c1 = v c / pow2 15); Math.Lemmas.pow2_minus 16 15; assert (v c1 = 0 \/ v c1 = 1) val modulo_pow2_u16: a:uint16 -> b:size_nat{b < 16} -> Lemma (v a % pow2 b == v (a &. ((u16 1 <<. size b) -. u16 1))) let modulo_pow2_u16 a b = Math.Lemmas.pow2_lt_compat 16 b; mod_mask_lemma #U16 a (size b); assert (v (mod_mask #U16 #SEC (size b)) == v ((u16 1 <<. size b) -. u16 1)) val modulo_pow2_u64: a:uint64 -> b:size_nat{b < 64} -> Lemma (v a % pow2 b == v (a &. ((u64 1 <<. size b) -. u64 1))) let modulo_pow2_u64 a b = Math.Lemmas.pow2_lt_compat 64 b; mod_mask_lemma #U64 a (size b); assert (v (mod_mask #U64 #SEC (size b)) == v ((u64 1 <<. size b) -. u64 1)) val lognot_plus_one: e:uint16 -> Lemma (v (lognot e) == modulus U16 - v e - 1) let lognot_plus_one e = lognot_spec e; assert (v (lognot e) == UInt.lognot #16 (v e)); UInt.lemma_lognot_value_mod #16 (v e); assert (v (lognot e) == pow2 16 - v e - 1) val lemma_frodo_sample2: sign:uint16{v sign <= 1} -> e:uint16 -> Lemma (((lognot sign +. u16 1) ^. e) +. sign == u16 ((Math.Lib.powx (-1) (v sign) * v e) % modulus U16)) let lemma_frodo_sample2 sign e = calc (==) { v ((lognot sign +. u16 1) ^. e); (==) { logxor_spec (lognot sign +. u16 1) e } logxor_v #U16 (v (lognot sign +. u16 1)) (v e); (==) { lognot_plus_one sign } logxor_v #U16 ((modulus U16 - v sign) % modulus U16) (v e); (==) { UInt.logxor_commutative #16 ((modulus U16 - v sign) % modulus U16) (v e) } logxor_v #U16 (v e) ((modulus U16 - v sign) % modulus U16); }; if v sign = 0 then begin calc (==) { logxor_v #U16 (v e) ((modulus U16 - v sign) % modulus U16); (==) { Math.Lemmas.multiple_modulo_lemma 1 (modulus U16) } logxor_v #U16 (v e) 0; (==) { UInt.logxor_lemma_1 #16 (v e) } v e; }; assert (v (((lognot sign +. u16 1) ^. e) +. sign) == v e); assert_norm (Math.Lib.powx (-1) 0 = 1); Math.Lemmas.small_mod (v e) (modulus U16) end else begin calc (==) { logxor_v #U16 (v e) ((modulus U16 - v sign) % modulus U16); (==) { Math.Lemmas.small_mod (modulus U16 - v sign) (modulus U16) } logxor_v #U16 (v e) (UInt.ones 16); (==) { UInt.logxor_lemma_2 #16 (v e) } lognot_v #U16 (v e); (==) { UInt.lemma_lognot_value_mod #16 (v e) } modulus U16 - v e - 1; }; assert (v (((lognot sign +. u16 1) ^. e) +. sign) == (modulus U16 - v e) % modulus U16); assert_norm (Math.Lib.powx (-1) 1 = -1) end val lemma_mul_acc_comm: a:size_nat -> b:size_nat -> c:size_nat -> Lemma (a * b * c = c * a * b) let lemma_mul_acc_comm a b c = () val lemma_matrix_index_repeati1: n1:size_nat -> n2:size_nat -> i:size_nat{i < n1} -> j:size_nat{j < n2} -> Lemma (2 * (i * n2 + j) + 2 <= 2 * n1 * n2)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Spec.Frodo.Lemmas.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
n1: Lib.IntTypes.size_nat -> n2: Lib.IntTypes.size_nat -> i: Lib.IntTypes.size_nat{i < n1} -> j: Lib.IntTypes.size_nat{j < n2} -> FStar.Pervasives.Lemma (ensures 2 * (i * n2 + j) + 2 <= (2 * n1) * n2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Lib.IntTypes.size_nat", "Prims.b2t", "Prims.op_LessThan", "FStar.Calc.calc_finish", "Prims.int", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "FStar.Mul.op_Star", "Prims.Cons", "FStar.Preorder.relation", "Prims.eq2", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "Prims.op_Subtraction", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.lemma_mult_le_right", "Prims.squash", "Prims._assert" ]
[]
false
false
true
false
false
let lemma_matrix_index_repeati1 n1 n2 i j =
assert (i * n2 + j <= (n1 - 1) * n2 + (n2 - 1)); calc ( <= ) { 2 * (i * n2 + j) + 2; ( <= ) { Math.Lemmas.lemma_mult_le_right n2 i (n1 - 1) } 2 * ((n1 - 1) * n2 + (n2 - 1)) + 2; ( == ) { () } (2 * (n1 - 1)) * n2 + 2 * n2 - 2 + 2; ( == ) { () } (2 * n1) * n2; }
false
EverParse3d.Readable.fsti
EverParse3d.Readable.unreadable_merge'
val unreadable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (unreadable h p from mid /\ unreadable h p mid to)) (ensures (unreadable h p from to))
val unreadable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (unreadable h p from mid /\ unreadable h p mid to)) (ensures (unreadable h p from to))
let unreadable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires ( unreadable h p from mid /\ unreadable h p mid to )) (ensures (unreadable h p from to)) = unreadable_split h p from mid to
{ "file_name": "src/3d/prelude/buffer/EverParse3d.Readable.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 34, "end_line": 263, "start_col": 0, "start_line": 251 }
module EverParse3d.Readable module B = LowStar.Buffer module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module U32 = FStar.UInt32 module LPL = LowParse.Low.Base // not erasable because Low* buffers of erased elements are not erasable inline_for_extraction noextract val perm0 (t: Type) : Tot Type0 val perm_prop (#t: Type) (x: perm0 t) (b: B.buffer t) : Tot prop inline_for_extraction noextract let perm (#t: Type) (b: B.buffer t) = (x: perm0 t { perm_prop x b }) val loc_perm (#t: _) (#b: B.buffer t) (p: perm b) : GTot B.loc val loc_perm_prop (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (B.address_liveness_insensitive_locs `B.loc_includes` loc_perm p) [SMTPat (loc_perm p)] val valid_perm (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : GTot Type0 val valid_perm_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (requires (valid_perm h p)) (ensures ( B.live h b /\ B.loc_buffer b `B.loc_disjoint` loc_perm p /\ loc_perm p `B.loc_in` h )) [SMTPat (valid_perm h p)] val preserved (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Tot prop val valid_perm_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) let valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) [SMTPatOr [ [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h p) ] ; [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p) ] ; ]] = valid_perm_frame h p l h' val preserved_refl (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h: HS.mem) : Lemma (preserved p from to h h) val preserved_trans (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h1 h2 h3: HS.mem) : Lemma (requires ( preserved p from to h1 h2 /\ preserved p from to h2 h3 )) (ensures ( preserved p from to h1 h3 )) val preserved_split (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Lemma (preserved p from to h h' <==> (preserved p from mid h h' /\ preserved p mid to h h')) val readable (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : GTot Type0 val readable_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (valid_perm h p)) [SMTPat (readable h p from to)] val readable_split (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (readable h p from to <==> (readable h p from mid /\ readable h p mid to)) let readable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (readable h p from mid /\ readable h p mid to)) = readable_split h p from mid to let readable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires ( readable h p from mid /\ readable h p mid to )) (ensures (readable h p from to)) = readable_split h p from mid to val readable_frame0 (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h' : HS.mem) : Lemma (requires ( readable h p from to /\ preserved p from to h h' )) (ensures ( readable h' p from to )) let readable_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (l: B.loc) (h' : HS.mem) : Lemma (requires ( readable h p from to /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( readable h' p from to )) [SMTPatOr [ [ SMTPat (B.modifies l h h'); SMTPat (readable h p from to) ] ; [ SMTPat (B.modifies l h h'); SMTPat (readable h' p from to) ] ; ]] = valid_perm_frame h p l h' ; preserved_split p 0ul from (B.len b) h h' ; preserved_split p from to (B.len b) h h' ; readable_frame0 h p from to h' val unreadable (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : GTot Type0 val unreadable_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (~ (valid_perm h p))) (ensures (unreadable h p from to)) [SMTPat (readable h p from to)] val readable_not_unreadable (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from < (* important: not equal *) U32.v to /\ U32.v to <= B.length b }) : Lemma (~ (readable h p from to /\ unreadable h p from to)) val unreadable_split (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (unreadable h p from to <==> (unreadable h p from mid /\ unreadable h p mid to)) let unreadable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (unreadable h p from to)) (ensures (unreadable h p from mid /\ unreadable h p mid to)) = unreadable_split h p from mid to
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "EverParse3d.Readable.fsti" }
[ { "abbrev": true, "full_module": "LowParse.Low.Base", "short_module": "LPL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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=100" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 8, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> p: EverParse3d.Readable.perm b -> from: FStar.UInt32.t -> mid: FStar.UInt32.t -> to: FStar.UInt32.t { FStar.UInt32.v from <= FStar.UInt32.v mid /\ FStar.UInt32.v mid <= FStar.UInt32.v to /\ FStar.UInt32.v to <= LowStar.Monotonic.Buffer.length b } -> FStar.Pervasives.Lemma (requires EverParse3d.Readable.unreadable h p from mid /\ EverParse3d.Readable.unreadable h p mid to) (ensures EverParse3d.Readable.unreadable h p from to)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Monotonic.HyperStack.mem", "LowStar.Buffer.buffer", "EverParse3d.Readable.perm", "FStar.UInt32.t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "EverParse3d.Readable.unreadable_split", "Prims.unit", "EverParse3d.Readable.unreadable", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let unreadable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (unreadable h p from mid /\ unreadable h p mid to)) (ensures (unreadable h p from to)) =
unreadable_split h p from mid to
false
EverParse3d.Readable.fsti
EverParse3d.Readable.valid_perm_frame_pat
val valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h': HS.mem) : Lemma (requires (valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b)) (ensures (valid_perm h' p /\ preserved p 0ul (B.len b) h h')) [ SMTPatOr [ [SMTPat (B.modifies l h h'); SMTPat (valid_perm h p)]; [SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p)] ] ]
val valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h': HS.mem) : Lemma (requires (valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b)) (ensures (valid_perm h' p /\ preserved p 0ul (B.len b) h h')) [ SMTPatOr [ [SMTPat (B.modifies l h h'); SMTPat (valid_perm h p)]; [SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p)] ] ]
let valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) [SMTPatOr [ [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h p) ] ; [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p) ] ; ]] = valid_perm_frame h p l h'
{ "file_name": "src/3d/prelude/buffer/EverParse3d.Readable.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 27, "end_line": 80, "start_col": 0, "start_line": 60 }
module EverParse3d.Readable module B = LowStar.Buffer module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module U32 = FStar.UInt32 module LPL = LowParse.Low.Base // not erasable because Low* buffers of erased elements are not erasable inline_for_extraction noextract val perm0 (t: Type) : Tot Type0 val perm_prop (#t: Type) (x: perm0 t) (b: B.buffer t) : Tot prop inline_for_extraction noextract let perm (#t: Type) (b: B.buffer t) = (x: perm0 t { perm_prop x b }) val loc_perm (#t: _) (#b: B.buffer t) (p: perm b) : GTot B.loc val loc_perm_prop (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (B.address_liveness_insensitive_locs `B.loc_includes` loc_perm p) [SMTPat (loc_perm p)] val valid_perm (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : GTot Type0 val valid_perm_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (requires (valid_perm h p)) (ensures ( B.live h b /\ B.loc_buffer b `B.loc_disjoint` loc_perm p /\ loc_perm p `B.loc_in` h )) [SMTPat (valid_perm h p)] val preserved (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Tot prop val valid_perm_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "EverParse3d.Readable.fsti" }
[ { "abbrev": true, "full_module": "LowParse.Low.Base", "short_module": "LPL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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=100" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 8, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> p: EverParse3d.Readable.perm b -> l: LowStar.Monotonic.Buffer.loc -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires EverParse3d.Readable.valid_perm h p /\ LowStar.Monotonic.Buffer.modifies l h h' /\ LowStar.Monotonic.Buffer.loc_disjoint (EverParse3d.Readable.loc_perm p) l /\ LowStar.Monotonic.Buffer.live h' b) (ensures EverParse3d.Readable.valid_perm h' p /\ EverParse3d.Readable.preserved p 0ul (LowStar.Monotonic.Buffer.len b) h h') [ SMTPatOr [ [ SMTPat (LowStar.Monotonic.Buffer.modifies l h h'); SMTPat (EverParse3d.Readable.valid_perm h p) ]; [ SMTPat (LowStar.Monotonic.Buffer.modifies l h h'); SMTPat (EverParse3d.Readable.valid_perm h' p) ] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Monotonic.HyperStack.mem", "LowStar.Buffer.buffer", "EverParse3d.Readable.perm", "LowStar.Monotonic.Buffer.loc", "EverParse3d.Readable.valid_perm_frame", "Prims.unit", "Prims.l_and", "EverParse3d.Readable.valid_perm", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_disjoint", "EverParse3d.Readable.loc_perm", "LowStar.Monotonic.Buffer.live", "LowStar.Buffer.trivial_preorder", "Prims.squash", "EverParse3d.Readable.preserved", "FStar.UInt32.__uint_to_t", "LowStar.Monotonic.Buffer.len", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat_or", "Prims.list", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
true
false
true
false
false
let valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h': HS.mem) : Lemma (requires (valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b)) (ensures (valid_perm h' p /\ preserved p 0ul (B.len b) h h')) [ SMTPatOr [ [SMTPat (B.modifies l h h'); SMTPat (valid_perm h p)]; [SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p)] ] ] =
valid_perm_frame h p l h'
false
EverParse3d.Readable.fsti
EverParse3d.Readable.unreadable_split'
val unreadable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (unreadable h p from to)) (ensures (unreadable h p from mid /\ unreadable h p mid to))
val unreadable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (unreadable h p from to)) (ensures (unreadable h p from mid /\ unreadable h p mid to))
let unreadable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (unreadable h p from to)) (ensures (unreadable h p from mid /\ unreadable h p mid to)) = unreadable_split h p from mid to
{ "file_name": "src/3d/prelude/buffer/EverParse3d.Readable.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 34, "end_line": 249, "start_col": 0, "start_line": 240 }
module EverParse3d.Readable module B = LowStar.Buffer module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module U32 = FStar.UInt32 module LPL = LowParse.Low.Base // not erasable because Low* buffers of erased elements are not erasable inline_for_extraction noextract val perm0 (t: Type) : Tot Type0 val perm_prop (#t: Type) (x: perm0 t) (b: B.buffer t) : Tot prop inline_for_extraction noextract let perm (#t: Type) (b: B.buffer t) = (x: perm0 t { perm_prop x b }) val loc_perm (#t: _) (#b: B.buffer t) (p: perm b) : GTot B.loc val loc_perm_prop (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (B.address_liveness_insensitive_locs `B.loc_includes` loc_perm p) [SMTPat (loc_perm p)] val valid_perm (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : GTot Type0 val valid_perm_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (requires (valid_perm h p)) (ensures ( B.live h b /\ B.loc_buffer b `B.loc_disjoint` loc_perm p /\ loc_perm p `B.loc_in` h )) [SMTPat (valid_perm h p)] val preserved (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Tot prop val valid_perm_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) let valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) [SMTPatOr [ [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h p) ] ; [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p) ] ; ]] = valid_perm_frame h p l h' val preserved_refl (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h: HS.mem) : Lemma (preserved p from to h h) val preserved_trans (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h1 h2 h3: HS.mem) : Lemma (requires ( preserved p from to h1 h2 /\ preserved p from to h2 h3 )) (ensures ( preserved p from to h1 h3 )) val preserved_split (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Lemma (preserved p from to h h' <==> (preserved p from mid h h' /\ preserved p mid to h h')) val readable (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : GTot Type0 val readable_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (valid_perm h p)) [SMTPat (readable h p from to)] val readable_split (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (readable h p from to <==> (readable h p from mid /\ readable h p mid to)) let readable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (readable h p from mid /\ readable h p mid to)) = readable_split h p from mid to let readable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires ( readable h p from mid /\ readable h p mid to )) (ensures (readable h p from to)) = readable_split h p from mid to val readable_frame0 (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h' : HS.mem) : Lemma (requires ( readable h p from to /\ preserved p from to h h' )) (ensures ( readable h' p from to )) let readable_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (l: B.loc) (h' : HS.mem) : Lemma (requires ( readable h p from to /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( readable h' p from to )) [SMTPatOr [ [ SMTPat (B.modifies l h h'); SMTPat (readable h p from to) ] ; [ SMTPat (B.modifies l h h'); SMTPat (readable h' p from to) ] ; ]] = valid_perm_frame h p l h' ; preserved_split p 0ul from (B.len b) h h' ; preserved_split p from to (B.len b) h h' ; readable_frame0 h p from to h' val unreadable (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : GTot Type0 val unreadable_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (~ (valid_perm h p))) (ensures (unreadable h p from to)) [SMTPat (readable h p from to)] val readable_not_unreadable (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from < (* important: not equal *) U32.v to /\ U32.v to <= B.length b }) : Lemma (~ (readable h p from to /\ unreadable h p from to)) val unreadable_split (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (unreadable h p from to <==> (unreadable h p from mid /\ unreadable h p mid to))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "EverParse3d.Readable.fsti" }
[ { "abbrev": true, "full_module": "LowParse.Low.Base", "short_module": "LPL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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=100" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 8, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> p: EverParse3d.Readable.perm b -> from: FStar.UInt32.t -> mid: FStar.UInt32.t -> to: FStar.UInt32.t { FStar.UInt32.v from <= FStar.UInt32.v mid /\ FStar.UInt32.v mid <= FStar.UInt32.v to /\ FStar.UInt32.v to <= LowStar.Monotonic.Buffer.length b } -> FStar.Pervasives.Lemma (requires EverParse3d.Readable.unreadable h p from to) (ensures EverParse3d.Readable.unreadable h p from mid /\ EverParse3d.Readable.unreadable h p mid to)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Monotonic.HyperStack.mem", "LowStar.Buffer.buffer", "EverParse3d.Readable.perm", "FStar.UInt32.t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "EverParse3d.Readable.unreadable_split", "Prims.unit", "EverParse3d.Readable.unreadable", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let unreadable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (unreadable h p from to)) (ensures (unreadable h p from mid /\ unreadable h p mid to)) =
unreadable_split h p from mid to
false
EverParse3d.Readable.fsti
EverParse3d.Readable.readable_frame
val readable_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t{U32.v from <= U32.v to /\ U32.v to <= B.length b}) (l: B.loc) (h': HS.mem) : Lemma (requires (readable h p from to /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b)) (ensures (readable h' p from to)) [ SMTPatOr [ [SMTPat (B.modifies l h h'); SMTPat (readable h p from to)]; [SMTPat (B.modifies l h h'); SMTPat (readable h' p from to)] ] ]
val readable_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t{U32.v from <= U32.v to /\ U32.v to <= B.length b}) (l: B.loc) (h': HS.mem) : Lemma (requires (readable h p from to /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b)) (ensures (readable h' p from to)) [ SMTPatOr [ [SMTPat (B.modifies l h h'); SMTPat (readable h p from to)]; [SMTPat (B.modifies l h h'); SMTPat (readable h' p from to)] ] ]
let readable_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (l: B.loc) (h' : HS.mem) : Lemma (requires ( readable h p from to /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( readable h' p from to )) [SMTPatOr [ [ SMTPat (B.modifies l h h'); SMTPat (readable h p from to) ] ; [ SMTPat (B.modifies l h h'); SMTPat (readable h' p from to) ] ; ]] = valid_perm_frame h p l h' ; preserved_split p 0ul from (B.len b) h h' ; preserved_split p from to (B.len b) h h' ; readable_frame0 h p from to h'
{ "file_name": "src/3d/prelude/buffer/EverParse3d.Readable.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 32, "end_line": 204, "start_col": 0, "start_line": 179 }
module EverParse3d.Readable module B = LowStar.Buffer module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module U32 = FStar.UInt32 module LPL = LowParse.Low.Base // not erasable because Low* buffers of erased elements are not erasable inline_for_extraction noextract val perm0 (t: Type) : Tot Type0 val perm_prop (#t: Type) (x: perm0 t) (b: B.buffer t) : Tot prop inline_for_extraction noextract let perm (#t: Type) (b: B.buffer t) = (x: perm0 t { perm_prop x b }) val loc_perm (#t: _) (#b: B.buffer t) (p: perm b) : GTot B.loc val loc_perm_prop (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (B.address_liveness_insensitive_locs `B.loc_includes` loc_perm p) [SMTPat (loc_perm p)] val valid_perm (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : GTot Type0 val valid_perm_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (requires (valid_perm h p)) (ensures ( B.live h b /\ B.loc_buffer b `B.loc_disjoint` loc_perm p /\ loc_perm p `B.loc_in` h )) [SMTPat (valid_perm h p)] val preserved (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Tot prop val valid_perm_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) let valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) [SMTPatOr [ [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h p) ] ; [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p) ] ; ]] = valid_perm_frame h p l h' val preserved_refl (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h: HS.mem) : Lemma (preserved p from to h h) val preserved_trans (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h1 h2 h3: HS.mem) : Lemma (requires ( preserved p from to h1 h2 /\ preserved p from to h2 h3 )) (ensures ( preserved p from to h1 h3 )) val preserved_split (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Lemma (preserved p from to h h' <==> (preserved p from mid h h' /\ preserved p mid to h h')) val readable (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : GTot Type0 val readable_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (valid_perm h p)) [SMTPat (readable h p from to)] val readable_split (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (readable h p from to <==> (readable h p from mid /\ readable h p mid to)) let readable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (readable h p from mid /\ readable h p mid to)) = readable_split h p from mid to let readable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires ( readable h p from mid /\ readable h p mid to )) (ensures (readable h p from to)) = readable_split h p from mid to val readable_frame0 (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h' : HS.mem) : Lemma (requires ( readable h p from to /\ preserved p from to h h' )) (ensures ( readable h' p from to ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "EverParse3d.Readable.fsti" }
[ { "abbrev": true, "full_module": "LowParse.Low.Base", "short_module": "LPL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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=100" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 8, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> p: EverParse3d.Readable.perm b -> from: FStar.UInt32.t -> to: FStar.UInt32.t { FStar.UInt32.v from <= FStar.UInt32.v to /\ FStar.UInt32.v to <= LowStar.Monotonic.Buffer.length b } -> l: LowStar.Monotonic.Buffer.loc -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires EverParse3d.Readable.readable h p from to /\ LowStar.Monotonic.Buffer.modifies l h h' /\ LowStar.Monotonic.Buffer.loc_disjoint (EverParse3d.Readable.loc_perm p) l /\ LowStar.Monotonic.Buffer.live h' b) (ensures EverParse3d.Readable.readable h' p from to) [ SMTPatOr [ [ SMTPat (LowStar.Monotonic.Buffer.modifies l h h'); SMTPat (EverParse3d.Readable.readable h p from to) ]; [ SMTPat (LowStar.Monotonic.Buffer.modifies l h h'); SMTPat (EverParse3d.Readable.readable h' p from to) ] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Monotonic.HyperStack.mem", "LowStar.Buffer.buffer", "EverParse3d.Readable.perm", "FStar.UInt32.t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "LowStar.Monotonic.Buffer.loc", "EverParse3d.Readable.readable_frame0", "Prims.unit", "EverParse3d.Readable.preserved_split", "LowStar.Monotonic.Buffer.len", "FStar.UInt32.__uint_to_t", "EverParse3d.Readable.valid_perm_frame", "EverParse3d.Readable.readable", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_disjoint", "EverParse3d.Readable.loc_perm", "LowStar.Monotonic.Buffer.live", "Prims.squash", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat_or", "Prims.list", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
true
false
true
false
false
let readable_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t{U32.v from <= U32.v to /\ U32.v to <= B.length b}) (l: B.loc) (h': HS.mem) : Lemma (requires (readable h p from to /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b)) (ensures (readable h' p from to)) [ SMTPatOr [ [SMTPat (B.modifies l h h'); SMTPat (readable h p from to)]; [SMTPat (B.modifies l h h'); SMTPat (readable h' p from to)] ] ] =
valid_perm_frame h p l h'; preserved_split p 0ul from (B.len b) h h'; preserved_split p from to (B.len b) h h'; readable_frame0 h p from to h'
false
Spec.Frodo.Lemmas.fst
Spec.Frodo.Lemmas.lemma_matrix_index_repeati
val lemma_matrix_index_repeati: n1:size_nat -> n2:size_nat{n1 * n2 <= max_size_t /\ n2 % 8 = 0} -> d:size_nat{d * n1 <= max_size_t /\ d * n1 * n2 / 8 <= max_size_t} -> i:size_nat{i < n1} -> j:size_nat{j < n2 / 8} -> Lemma (i * (n2 / 8) <= max_size_t /\ i * (n2 / 8) + j <= max_size_t /\ (i * (n2 / 8) + j) * d <= max_size_t /\ (i * (n2 / 8) + j) * d + d <= d * n1 * n2 / 8)
val lemma_matrix_index_repeati: n1:size_nat -> n2:size_nat{n1 * n2 <= max_size_t /\ n2 % 8 = 0} -> d:size_nat{d * n1 <= max_size_t /\ d * n1 * n2 / 8 <= max_size_t} -> i:size_nat{i < n1} -> j:size_nat{j < n2 / 8} -> Lemma (i * (n2 / 8) <= max_size_t /\ i * (n2 / 8) + j <= max_size_t /\ (i * (n2 / 8) + j) * d <= max_size_t /\ (i * (n2 / 8) + j) * d + d <= d * n1 * n2 / 8)
let lemma_matrix_index_repeati n1 n2 d i j = calc (<=) { i * (n2 / 8) + j; <= { } (n1 - 1) * (n2 / 8) + j; <= { } (n1 - 1) * (n2 / 8) + (n2 / 8 - 1); }; Math.Lemmas.lemma_mult_le_right d (i * (n2 / 8) + j) (n1 * (n2 / 8) - 1)
{ "file_name": "specs/frodo/Spec.Frodo.Lemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 74, "end_line": 152, "start_col": 0, "start_line": 144 }
module Spec.Frodo.Lemmas open FStar.Mul open Lib.IntTypes #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_mask_cast: mask:uint16{v mask = 0 \/ v mask = v (ones U16 SEC)} -> Lemma ((v mask = 0 ==> v (to_u8 mask) = 0) /\ (v mask = v (ones U16 SEC) ==> v (to_u8 mask) = v (ones U8 SEC))) let lemma_mask_cast mask = () // To avoid integral promotion, a cast to uint_16 is needed // https://en.cppreference.com/w/cpp/language/operator_arithmetic val lemma_frodo_sample: a:uint16{v a < pow2 15} -> b:uint16{v b < pow2 15} -> Lemma (let c0 = if v a > v b then 1 else 0 in let c1 = to_u16 (to_u32 (b -. a)) >>. 15ul in v c1 == c0) let lemma_frodo_sample a b = let c = to_u16 (to_u32 (b -. a)) in assert (v c < modulus U16); Math.Lemmas.lemma_div_lt (uint_v c) 16 15; let c1 = c >>. 15ul in assert (v c1 = v c / pow2 15); Math.Lemmas.pow2_minus 16 15; assert (v c1 = 0 \/ v c1 = 1) val modulo_pow2_u16: a:uint16 -> b:size_nat{b < 16} -> Lemma (v a % pow2 b == v (a &. ((u16 1 <<. size b) -. u16 1))) let modulo_pow2_u16 a b = Math.Lemmas.pow2_lt_compat 16 b; mod_mask_lemma #U16 a (size b); assert (v (mod_mask #U16 #SEC (size b)) == v ((u16 1 <<. size b) -. u16 1)) val modulo_pow2_u64: a:uint64 -> b:size_nat{b < 64} -> Lemma (v a % pow2 b == v (a &. ((u64 1 <<. size b) -. u64 1))) let modulo_pow2_u64 a b = Math.Lemmas.pow2_lt_compat 64 b; mod_mask_lemma #U64 a (size b); assert (v (mod_mask #U64 #SEC (size b)) == v ((u64 1 <<. size b) -. u64 1)) val lognot_plus_one: e:uint16 -> Lemma (v (lognot e) == modulus U16 - v e - 1) let lognot_plus_one e = lognot_spec e; assert (v (lognot e) == UInt.lognot #16 (v e)); UInt.lemma_lognot_value_mod #16 (v e); assert (v (lognot e) == pow2 16 - v e - 1) val lemma_frodo_sample2: sign:uint16{v sign <= 1} -> e:uint16 -> Lemma (((lognot sign +. u16 1) ^. e) +. sign == u16 ((Math.Lib.powx (-1) (v sign) * v e) % modulus U16)) let lemma_frodo_sample2 sign e = calc (==) { v ((lognot sign +. u16 1) ^. e); (==) { logxor_spec (lognot sign +. u16 1) e } logxor_v #U16 (v (lognot sign +. u16 1)) (v e); (==) { lognot_plus_one sign } logxor_v #U16 ((modulus U16 - v sign) % modulus U16) (v e); (==) { UInt.logxor_commutative #16 ((modulus U16 - v sign) % modulus U16) (v e) } logxor_v #U16 (v e) ((modulus U16 - v sign) % modulus U16); }; if v sign = 0 then begin calc (==) { logxor_v #U16 (v e) ((modulus U16 - v sign) % modulus U16); (==) { Math.Lemmas.multiple_modulo_lemma 1 (modulus U16) } logxor_v #U16 (v e) 0; (==) { UInt.logxor_lemma_1 #16 (v e) } v e; }; assert (v (((lognot sign +. u16 1) ^. e) +. sign) == v e); assert_norm (Math.Lib.powx (-1) 0 = 1); Math.Lemmas.small_mod (v e) (modulus U16) end else begin calc (==) { logxor_v #U16 (v e) ((modulus U16 - v sign) % modulus U16); (==) { Math.Lemmas.small_mod (modulus U16 - v sign) (modulus U16) } logxor_v #U16 (v e) (UInt.ones 16); (==) { UInt.logxor_lemma_2 #16 (v e) } lognot_v #U16 (v e); (==) { UInt.lemma_lognot_value_mod #16 (v e) } modulus U16 - v e - 1; }; assert (v (((lognot sign +. u16 1) ^. e) +. sign) == (modulus U16 - v e) % modulus U16); assert_norm (Math.Lib.powx (-1) 1 = -1) end val lemma_mul_acc_comm: a:size_nat -> b:size_nat -> c:size_nat -> Lemma (a * b * c = c * a * b) let lemma_mul_acc_comm a b c = () val lemma_matrix_index_repeati1: n1:size_nat -> n2:size_nat -> i:size_nat{i < n1} -> j:size_nat{j < n2} -> Lemma (2 * (i * n2 + j) + 2 <= 2 * n1 * n2) let lemma_matrix_index_repeati1 n1 n2 i j = assert (i * n2 + j <= (n1 - 1) * n2 + (n2 - 1)); calc (<=) { 2 * (i * n2 + j) + 2; <= { Math.Lemmas.lemma_mult_le_right n2 i (n1 - 1) } 2 * ((n1 - 1) * n2 + (n2 - 1)) + 2; == { } 2 * (n1 - 1) * n2 + 2 * n2 - 2 + 2; == { } 2 * n1 * n2; } val lemma_matrix_index_repeati2: n1:size_nat -> n2:size_nat -> i:size_nat{i < n1} -> j:size_nat{j < n2} -> Lemma (2 * (n1 * j + i) + 2 <= 2 * n1 * n2) let lemma_matrix_index_repeati2 n1 n2 i j = lemma_matrix_index_repeati1 n2 n1 j i val lemma_matrix_index_repeati: n1:size_nat -> n2:size_nat{n1 * n2 <= max_size_t /\ n2 % 8 = 0} -> d:size_nat{d * n1 <= max_size_t /\ d * n1 * n2 / 8 <= max_size_t} -> i:size_nat{i < n1} -> j:size_nat{j < n2 / 8} -> Lemma (i * (n2 / 8) <= max_size_t /\ i * (n2 / 8) + j <= max_size_t /\ (i * (n2 / 8) + j) * d <= max_size_t /\ (i * (n2 / 8) + j) * d + d <= d * n1 * n2 / 8)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Spec.Frodo.Lemmas.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
n1: Lib.IntTypes.size_nat -> n2: Lib.IntTypes.size_nat{n1 * n2 <= Lib.IntTypes.max_size_t /\ n2 % 8 = 0} -> d: Lib.IntTypes.size_nat {d * n1 <= Lib.IntTypes.max_size_t /\ (d * n1) * n2 / 8 <= Lib.IntTypes.max_size_t} -> i: Lib.IntTypes.size_nat{i < n1} -> j: Lib.IntTypes.size_nat{j < n2 / 8} -> FStar.Pervasives.Lemma (ensures i * (n2 / 8) <= Lib.IntTypes.max_size_t /\ i * (n2 / 8) + j <= Lib.IntTypes.max_size_t /\ (i * (n2 / 8) + j) * d <= Lib.IntTypes.max_size_t /\ (i * (n2 / 8) + j) * d + d <= (d * n1) * n2 / 8)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Lib.IntTypes.size_nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Lib.IntTypes.max_size_t", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "Prims.op_Division", "Prims.op_LessThan", "FStar.Math.Lemmas.lemma_mult_le_right", "Prims.op_Addition", "Prims.op_Subtraction", "Prims.unit", "FStar.Calc.calc_finish", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Prims.squash" ]
[]
false
false
true
false
false
let lemma_matrix_index_repeati n1 n2 d i j =
calc ( <= ) { i * (n2 / 8) + j; ( <= ) { () } (n1 - 1) * (n2 / 8) + j; ( <= ) { () } (n1 - 1) * (n2 / 8) + (n2 / 8 - 1); }; Math.Lemmas.lemma_mult_le_right d (i * (n2 / 8) + j) (n1 * (n2 / 8) - 1)
false
EverParse3d.Readable.fsti
EverParse3d.Readable.readable_merge'
val readable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (readable h p from mid /\ readable h p mid to)) (ensures (readable h p from to))
val readable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (readable h p from mid /\ readable h p mid to)) (ensures (readable h p from to))
let readable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires ( readable h p from mid /\ readable h p mid to )) (ensures (readable h p from to)) = readable_split h p from mid to
{ "file_name": "src/3d/prelude/buffer/EverParse3d.Readable.fsti", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 32, "end_line": 162, "start_col": 0, "start_line": 150 }
module EverParse3d.Readable module B = LowStar.Buffer module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module U32 = FStar.UInt32 module LPL = LowParse.Low.Base // not erasable because Low* buffers of erased elements are not erasable inline_for_extraction noextract val perm0 (t: Type) : Tot Type0 val perm_prop (#t: Type) (x: perm0 t) (b: B.buffer t) : Tot prop inline_for_extraction noextract let perm (#t: Type) (b: B.buffer t) = (x: perm0 t { perm_prop x b }) val loc_perm (#t: _) (#b: B.buffer t) (p: perm b) : GTot B.loc val loc_perm_prop (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (B.address_liveness_insensitive_locs `B.loc_includes` loc_perm p) [SMTPat (loc_perm p)] val valid_perm (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : GTot Type0 val valid_perm_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) : Lemma (requires (valid_perm h p)) (ensures ( B.live h b /\ B.loc_buffer b `B.loc_disjoint` loc_perm p /\ loc_perm p `B.loc_in` h )) [SMTPat (valid_perm h p)] val preserved (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Tot prop val valid_perm_frame (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) let valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h' : HS.mem) : Lemma (requires ( valid_perm h p /\ B.modifies l h h' /\ B.loc_disjoint (loc_perm p) l /\ B.live h' b // because nothing prevents b from being deallocated )) (ensures ( valid_perm h' p /\ preserved p 0ul (B.len b) h h' )) [SMTPatOr [ [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h p) ] ; [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p) ] ; ]] = valid_perm_frame h p l h' val preserved_refl (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h: HS.mem) : Lemma (preserved p from to h h) val preserved_trans (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) (h1 h2 h3: HS.mem) : Lemma (requires ( preserved p from to h1 h2 /\ preserved p from to h2 h3 )) (ensures ( preserved p from to h1 h3 )) val preserved_split (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) (h h' : HS.mem) : Lemma (preserved p from to h h' <==> (preserved p from mid h h' /\ preserved p mid to h h')) val readable (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : GTot Type0 val readable_prop (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (to: U32.t { U32.v from <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (valid_perm h p)) [SMTPat (readable h p from to)] val readable_split (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (readable h p from to <==> (readable h p from mid /\ readable h p mid to)) let readable_split' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from: U32.t) (mid: U32.t) (to: U32.t { U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b }) : Lemma (requires (readable h p from to)) (ensures (readable h p from mid /\ readable h p mid to)) = readable_split h p from mid to
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParse.Low.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "EverParse3d.Readable.fsti" }
[ { "abbrev": true, "full_module": "LowParse.Low.Base", "short_module": "LPL" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "EverParse3d", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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=100" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 8, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> p: EverParse3d.Readable.perm b -> from: FStar.UInt32.t -> mid: FStar.UInt32.t -> to: FStar.UInt32.t { FStar.UInt32.v from <= FStar.UInt32.v mid /\ FStar.UInt32.v mid <= FStar.UInt32.v to /\ FStar.UInt32.v to <= LowStar.Monotonic.Buffer.length b } -> FStar.Pervasives.Lemma (requires EverParse3d.Readable.readable h p from mid /\ EverParse3d.Readable.readable h p mid to) (ensures EverParse3d.Readable.readable h p from to)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Monotonic.HyperStack.mem", "LowStar.Buffer.buffer", "EverParse3d.Readable.perm", "FStar.UInt32.t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "EverParse3d.Readable.readable_split", "Prims.unit", "EverParse3d.Readable.readable", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let readable_merge' (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (from mid: U32.t) (to: U32.t{U32.v from <= U32.v mid /\ U32.v mid <= U32.v to /\ U32.v to <= B.length b}) : Lemma (requires (readable h p from mid /\ readable h p mid to)) (ensures (readable h p from to)) =
readable_split h p from mid to
false
FStar.Modifies.fst
FStar.Modifies.aloc
val aloc (r: HS.rid) (n: nat) : Tot (Type u#1)
val aloc (r: HS.rid) (n: nat) : Tot (Type u#1)
let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } )
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 41, "end_line": 41, "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 FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: FStar.Monotonic.HyperHeap.rid -> n: Prims.nat -> Type
Prims.Tot
[ "total" ]
[]
[ "FStar.Monotonic.HyperHeap.rid", "Prims.nat", "FStar.Modifies.loc_aux", "FStar.Modifies.loc_aux_in_addr" ]
[]
false
false
false
true
true
let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) =
(l: loc_aux{loc_aux_in_addr l r n})
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_includes_buffer
val loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0
val loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0
let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 52, "end_line": 49, "start_col": 0, "start_line": 43 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc_aux -> b: FStar.Buffer.buffer a -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Buffer.buffer", "Prims.l_and", "Prims.eq2", "FStar.Buffer.includes" ]
[]
false
false
false
false
true
let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 =
match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_includes
val loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2)
val loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2)
let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 47, "end_line": 56, "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 FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc_aux -> s2: FStar.Modifies.loc_aux -> Prims.GTot Type0
Prims.GTot
[ "sometrivial", "" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Buffer.buffer", "FStar.Modifies.loc_aux_includes_buffer" ]
[]
false
false
false
false
true
let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) =
match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_includes_trans'
val loc_aux_includes_trans' (s1 s2 s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3)
val loc_aux_includes_trans' (s1 s2 s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3)
let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 59, "end_line": 98, "start_col": 0, "start_line": 93 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc_aux -> s2: FStar.Modifies.loc_aux -> s3: FStar.Modifies.loc_aux -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_aux_includes s1 s2 /\ FStar.Modifies.loc_aux_includes s2 s3 ==> FStar.Modifies.loc_aux_includes s1 s3)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Classical.move_requires", "Prims.l_and", "FStar.Modifies.loc_aux_includes", "FStar.Modifies.loc_aux_includes_trans", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.l_imp", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let loc_aux_includes_trans' (s1 s2 s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) =
Classical.move_requires (loc_aux_includes_trans s1 s2) s3
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_disjoint_buffer
val loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0
val loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0
let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 33, "end_line": 106, "start_col": 0, "start_line": 100 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: FStar.Modifies.loc_aux -> p: FStar.Buffer.buffer t -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Buffer.buffer", "FStar.Buffer.disjoint" ]
[]
false
false
false
false
true
let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 =
match l with | LocBuffer b -> B.disjoint b p
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_in_addr
val loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0
val loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0
let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 20, "end_line": 38, "start_col": 0, "start_line": 30 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: FStar.Modifies.loc_aux -> r: FStar.Monotonic.HyperHeap.rid -> n: Prims.nat -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Monotonic.HyperHeap.rid", "Prims.nat", "FStar.Buffer.buffer", "Prims.l_and", "Prims.eq2", "FStar.Buffer.frameOf", "Prims.int", "Prims.l_or", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "Prims.op_GreaterThan", "FStar.Buffer.as_addr" ]
[]
false
false
false
false
true
let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 =
match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_disjoint
val loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0
val loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0
let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 32, "end_line": 113, "start_col": 0, "start_line": 108 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l1: FStar.Modifies.loc_aux -> l2: FStar.Modifies.loc_aux -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Buffer.buffer", "FStar.Modifies.loc_aux_disjoint_buffer" ]
[]
false
false
false
false
true
let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 =
match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_includes_loc_aux_includes_buffer
val loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b))
val loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b))
let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 60, "end_line": 81, "start_col": 0, "start_line": 73 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc_aux -> s2: FStar.Modifies.loc_aux -> b: FStar.Buffer.buffer a -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_aux_includes s1 s2 /\ FStar.Modifies.loc_aux_includes_buffer s2 b ) (ensures FStar.Modifies.loc_aux_includes_buffer s1 b)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Buffer.buffer", "FStar.Modifies.loc_aux_includes_buffer_includes", "Prims.unit", "Prims.l_and", "FStar.Modifies.loc_aux_includes", "FStar.Modifies.loc_aux_includes_buffer", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) =
match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b
false
FStar.Modifies.fst
FStar.Modifies.loc
val loc : Type u#1
val loc : Type u#1
let loc = MG.loc cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 20, "end_line": 183, "start_col": 0, "start_line": 183 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type
Prims.Tot
[ "total" ]
[]
[ "FStar.ModifiesGen.loc", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
true
true
let loc =
MG.loc cls
false
FStar.Modifies.fst
FStar.Modifies.loc_none
val loc_none: loc
val loc_none: loc
let loc_none = MG.loc_none
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 26, "end_line": 185, "start_col": 0, "start_line": 185 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.Modifies.loc
Prims.Tot
[ "total" ]
[]
[ "FStar.ModifiesGen.loc_none", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
true
false
let loc_none =
MG.loc_none
false
FStar.Modifies.fst
FStar.Modifies.loc_union
val loc_union (s1 s2: loc) : GTot loc
val loc_union (s1 s2: loc) : GTot loc
let loc_union = MG.loc_union
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 187, "start_col": 0, "start_line": 187 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> Prims.GTot FStar.Modifies.loc
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.ModifiesGen.loc_union", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
false
false
let loc_union =
MG.loc_union
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_includes_trans
val loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3))
val loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3))
let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 67, "end_line": 89, "start_col": 0, "start_line": 83 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc_aux -> s2: FStar.Modifies.loc_aux -> s3: FStar.Modifies.loc_aux -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_aux_includes s1 s2 /\ FStar.Modifies.loc_aux_includes s2 s3) (ensures FStar.Modifies.loc_aux_includes s1 s3)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Buffer.buffer", "FStar.Modifies.loc_aux_includes_loc_aux_includes_buffer", "Prims.unit", "Prims.l_and", "FStar.Modifies.loc_aux_includes", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) =
match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_disjoint_loc_aux_includes_buffer
val loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3))
val loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3))
let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 61, "end_line": 139, "start_col": 0, "start_line": 131 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l1: FStar.Modifies.loc_aux -> l2: FStar.Modifies.loc_aux -> b3: FStar.Buffer.buffer t3 -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_aux_disjoint l1 l2 /\ FStar.Modifies.loc_aux_includes_buffer l2 b3) (ensures FStar.Modifies.loc_aux_disjoint_buffer l1 b3)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Buffer.buffer", "FStar.Modifies.loc_aux_disjoint_buffer_includes", "Prims.unit", "Prims.l_and", "FStar.Modifies.loc_aux_disjoint", "FStar.Modifies.loc_aux_includes_buffer", "Prims.squash", "FStar.Modifies.loc_aux_disjoint_buffer", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) =
match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3
false
Vale.Transformers.InstructionReorder.fst
Vale.Transformers.InstructionReorder.lemma_perform_reordering_with_hint
val lemma_perform_reordering_with_hint (t: transformation_hint) (cs: codes) (fuel: nat) (s: machine_state) : Lemma (requires ((Ok? (perform_reordering_with_hint t cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures (let Ok cs' = perform_reordering_with_hint t cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[t;fuel;cs])
val lemma_perform_reordering_with_hint (t: transformation_hint) (cs: codes) (fuel: nat) (s: machine_state) : Lemma (requires ((Ok? (perform_reordering_with_hint t cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures (let Ok cs' = perform_reordering_with_hint t cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[t;fuel;cs])
let rec lemma_perform_reordering_with_hint (t:transformation_hint) (cs:codes) (fuel:nat) (s:machine_state) : Lemma (requires ( (Ok? (perform_reordering_with_hint t cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures ( let Ok cs' = perform_reordering_with_hint t cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[t; fuel; cs]) = let c = cs in let Ok cs' = perform_reordering_with_hint t cs in let Some s' = machine_eval_codes cs fuel s in let x :: xs = cs in if is_empty_codes [x] then ( lemma_is_empty_codes [x] fuel s; match machine_eval_code x fuel s with | None -> () | Some s' -> lemma_eval_codes_equiv_states xs fuel s s'; lemma_perform_reordering_with_hint t xs fuel s ) else ( match t with | MoveUpFrom i -> ( let Ok c' = bubble_to_top c i in lemma_bubble_to_top c i fuel s s' ) | DiveInAt i t' -> ( FStar.List.Pure.lemma_split3_append c i; FStar.List.Pure.lemma_split3_length c i; let left, mid, right = L.split3 c i in let Block l = mid in let Ok (y :: ys) = perform_reordering_with_hint t' l in L.append_length left [y]; let Ok left' = bubble_to_top (left `L.append` [y]) i in // assert (cs' == y :: (left' `L.append` (Block ys :: right))); assert (left `L.append` (mid :: right) == c); L.append_l_cons mid right left; assert ((left `L.append` [mid]) `L.append` right == c); lemma_machine_eval_codes_block_to_append (left `L.append` [mid]) right fuel s; let Some s_1 = machine_eval_code (Block (left `L.append` [mid])) fuel s in assert (Some s_1 == machine_eval_codes (left `L.append` [mid]) fuel s); lemma_machine_eval_codes_block_to_append left [mid] fuel s; let Some s_2 = machine_eval_code (Block left) fuel s in assert (Some s_2 == machine_eval_codes left fuel s); // assert (Some s_1 == machine_eval_codes [mid] fuel s_2); assert (Some s_1 == machine_eval_code (Block l) fuel s_2); assert (Some s_1 == machine_eval_codes l fuel s_2); assert (Some s' == machine_eval_codes right fuel s_1); if s_1.ms_ok then () else lemma_not_ok_propagate_codes right fuel s_1; lemma_perform_reordering_with_hint t' l fuel s_2; // let Some s_11 = machine_eval_codes (y :: ys) fuel s_2 in let Some s_12 = machine_eval_code y fuel s_2 in if s_12.ms_ok then () else lemma_not_ok_propagate_codes ys fuel s_12; assert (Some s_2 == machine_eval_codes left fuel s); assert (Some s_2 == machine_eval_code (Block left) fuel s); assert (Some s_12 == machine_eval_codes (Block left :: [y]) fuel s); lemma_machine_eval_codes_block_to_append left [y] fuel s; assert (Some s_12 == machine_eval_codes (left `L.append` [y]) fuel s); lemma_bubble_to_top (left `L.append` [y]) i fuel s s_12; // lemma_append_single left y i; assert (L.index (left `L.append` [y]) i == y); // let Some s_3 = machine_eval_codes (y :: left') fuel s in assert (equiv_states s_3 s_12); lemma_eval_codes_equiv_states right fuel s_1 s_11; let Some s_0 = machine_eval_codes right fuel s_11 in lemma_eval_codes_equiv_states (Block ys :: right) fuel s_12 s_3; let Some s_00 = machine_eval_codes (Block ys :: right) fuel s_3 in // assert (equiv_states s_00 s'); assert (Some s_3 == machine_eval_code (Block (y :: left')) fuel s); assert (Some s_00 == machine_eval_codes (Block ys :: right) fuel s_3); lemma_machine_eval_codes_block_to_append (y :: left') (Block ys :: right) fuel s ) | InPlaceIfElse tht thf -> ( let IfElse cond c_ift c_iff :: xs = cs in let Block cs_ift, Block cs_iff = c_ift, c_iff in let (s1, b) = machine_eval_ocmp s cond in if b then ( assert (Some s' == machine_eval_codes (c_ift :: xs) fuel s1); let Some s'' = machine_eval_code c_ift fuel s1 in if not s''.ms_ok then (lemma_not_ok_propagate_codes xs fuel s'') else (); lemma_perform_reordering_with_hints tht cs_ift fuel s1; let Some s''' = machine_eval_code (IfElse cond c_ift c_iff) fuel s in let x' :: _ = cs' in let Some s'''' = machine_eval_code x' fuel s in assert (equiv_states s''' s''''); lemma_eval_codes_equiv_states xs fuel s''' s'''' ) else ( let Some s'' = machine_eval_code c_iff fuel s1 in if not s''.ms_ok then (lemma_not_ok_propagate_codes xs fuel s'') else (); lemma_perform_reordering_with_hints thf cs_iff fuel s1; let Some s''' = machine_eval_code (IfElse cond c_ift c_iff) fuel s in let x' :: _ = cs' in let Some s'''' = machine_eval_code x' fuel s in lemma_eval_codes_equiv_states xs fuel s''' s'''' ) ) | InPlaceWhile thb -> ( assert (fuel <> 0); let While cond body :: xs = cs in let Block cs_body = body in let (s0, b) = machine_eval_ocmp s cond in if not b then () else ( let Some s1 = machine_eval_code body (fuel - 1) s0 in if s1.ms_ok then () else lemma_not_ok_propagate_codes xs fuel s1; lemma_perform_reordering_with_hints thb cs_body (fuel - 1) s0; let x' :: xs' = cs' in assert (xs' == xs); let While cond' body' = x' in let cs_body' = body' in let Some s11 = machine_eval_code (While cond body) (fuel - 1) s1 in if s11.ms_ok then () else lemma_not_ok_propagate_codes xs fuel s11; assert (Some s' == machine_eval_codes xs fuel s11); lemma_perform_reordering_with_hint t [While cond body] (fuel - 1) s1; let Some s11' = machine_eval_code x' (fuel - 1) s1 in lemma_eval_codes_equiv_states xs fuel s11 s11'; let Some s'' = machine_eval_codes xs fuel s11' in assert (machine_eval_codes cs fuel s == Some s'); assert (equiv_states s' s''); let Some s1' = machine_eval_code body' (fuel - 1) s0 in lemma_eval_code_equiv_states x' (fuel-1) s1 s1'; let Some s11'' = machine_eval_code x' (fuel-1) s1' in assert (machine_eval_codes cs' fuel s == machine_eval_codes xs fuel s11''); lemma_eval_codes_equiv_states xs fuel s11' s11'' ) ) ) and lemma_perform_reordering_with_hints (ts:transformation_hints) (cs:codes) (fuel:nat) (s:machine_state) : Lemma (requires ( (Ok? (perform_reordering_with_hints ts cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures ( let Ok cs' = perform_reordering_with_hints ts cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[ts; fuel; cs]) = let c = cs in let Ok cs' = perform_reordering_with_hints ts cs in let Some s' = machine_eval_codes cs fuel s in match ts with | [] -> lemma_is_empty_codes cs fuel s | t :: ts' -> let Ok (x :: xs) = perform_reordering_with_hint t c in lemma_perform_reordering_with_hint t c fuel s; let Ok xs' = perform_reordering_with_hints ts' xs in let Some s1 = machine_eval_code x fuel s in lemma_perform_reordering_with_hints ts' xs fuel s1
{ "file_name": "vale/code/lib/transformers/Vale.Transformers.InstructionReorder.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 2126, "start_col": 0, "start_line": 1968 }
(** This module defines a transformer that performs safe instruction reordering. Example: The following set of instructions can be reordered in any order without any observable change in behavior: mov rax, 10 mov rbx, 3 Usage: Actual vale-tool or user-facing code should probably use the even nicer interface provided by the [Vale.Transformers.Transform] module. To use this module, you need to generate a [transformation_hints] object (a nice default is provided in this module via [find_transformation_hints], but users of this module can write their own, without needing to change any proofs), that can then be applied to a [codes] object (say [c1]) via [perform_reordering_with_hints] which tells you if this is a safe reordering, and if so, it produces the transformed [codes] object. If it is not considered to be safe, then the transformer gives a (human-readable) reason for why it doesn't consider it a safe reordering. If the transformation is safe and was indeed performed, then you can use [lemma_perform_reordering_with_hints] to reason about the reordered code having semantically equivalent behavior as the untransformed code. *) module Vale.Transformers.InstructionReorder /// Open all the relevant modules open Vale.X64.Bytes_Code_s open Vale.X64.Instruction_s open Vale.X64.Instructions_s open Vale.X64.Machine_Semantics_s open Vale.X64.Machine_s open Vale.X64.Print_s open Vale.Def.PossiblyMonad open Vale.Transformers.Locations open Vale.Transformers.BoundedInstructionEffects module L = FStar.List.Tot /// Some convenience functions let rec locations_of_locations_with_values (lv:locations_with_values) : locations = match lv with | [] -> [] | (|l,v|) :: lv -> l :: locations_of_locations_with_values lv /// Given two read/write sets corresponding to two neighboring /// instructions, we can say whether exchanging those two instructions /// should be allowed. let write_same_constants (c1 c2:locations_with_values) : pbool = for_all (fun (x1:location_with_value) -> for_all (fun (x2:location_with_value) -> let (| l1, v1 |) = x1 in let (| l2, v2 |) = x2 in (if l1 = l2 then v1 = v2 else true) /- "not writing same constants" ) c2 ) c1 let aux_write_exchange_allowed (w2:locations) (c1 c2:locations_with_values) (x:location) : pbool = let cv1, cv2 = locations_of_locations_with_values c1, locations_of_locations_with_values c2 in (disjoint_location_from_locations x w2) ||. ((x `L.mem` cv1 && x `L.mem` cv2) /- "non constant write") let write_exchange_allowed (w1 w2:locations) (c1 c2:locations_with_values) : pbool = write_same_constants c1 c2 &&. for_all (aux_write_exchange_allowed w2 c1 c2) w1 &&. (* REVIEW: Just to make the symmetry proof easier, we write the other way around too. However, this makes things not as fast as they _could_ be. *) for_all (aux_write_exchange_allowed w1 c2 c1) w2 let rw_exchange_allowed (rw1 rw2 : rw_set) : pbool = let r1, w1, c1 = rw1.loc_reads, rw1.loc_writes, rw1.loc_constant_writes in let r2, w2, c2 = rw2.loc_reads, rw2.loc_writes, rw2.loc_constant_writes in (disjoint_locations r1 w2 /+< "read set of 1st not disjoint from write set of 2nd because ") &&. (disjoint_locations r2 w1 /+< "read set of 2nd not disjoint from write set of 1st because ") &&. (write_exchange_allowed w1 w2 c1 c2 /+< "write sets not disjoint because ") let ins_exchange_allowed (i1 i2 : ins) : pbool = ( match i1, i2 with | Instr _ _ _, Instr _ _ _ -> (rw_exchange_allowed (rw_set_of_ins i1) (rw_set_of_ins i2)) | _, _ -> ffalse "non-generic instructions: conservatively disallowed exchange" ) /+> normal (" for instructions " ^ print_ins i1 gcc ^ " and " ^ print_ins i2 gcc) let rec lemma_write_same_constants_symmetric (c1 c2:locations_with_values) : Lemma (ensures (!!(write_same_constants c1 c2) = !!(write_same_constants c2 c1))) = match c1, c2 with | [], [] -> () | x :: xs, [] -> lemma_write_same_constants_symmetric xs [] | [], y :: ys -> lemma_write_same_constants_symmetric [] ys | x :: xs, y :: ys -> lemma_write_same_constants_symmetric c1 ys; lemma_write_same_constants_symmetric xs c2; lemma_write_same_constants_symmetric xs ys let lemma_write_exchange_allowed_symmetric (w1 w2:locations) (c1 c2:locations_with_values) : Lemma (ensures (!!(write_exchange_allowed w1 w2 c1 c2) = !!(write_exchange_allowed w2 w1 c2 c1))) = lemma_write_same_constants_symmetric c1 c2 let lemma_ins_exchange_allowed_symmetric (i1 i2 : ins) : Lemma (requires ( !!(ins_exchange_allowed i1 i2))) (ensures ( !!(ins_exchange_allowed i2 i1))) = let rw1, rw2 = rw_set_of_ins i1, rw_set_of_ins i2 in let r1, w1, c1 = rw1.loc_reads, rw1.loc_writes, rw1.loc_constant_writes in let r2, w2, c2 = rw2.loc_reads, rw2.loc_writes, rw2.loc_constant_writes in lemma_write_exchange_allowed_symmetric w1 w2 c1 c2 /// First, we must define what it means for two states to be /// equivalent. Here, we basically say they must be exactly the same. let equiv_states (s1 s2 : machine_state) : GTot Type0 = (s1.ms_ok == s2.ms_ok) /\ (s1.ms_regs == s2.ms_regs) /\ (cf s1.ms_flags = cf s2.ms_flags) /\ (overflow s1.ms_flags = overflow s2.ms_flags) /\ (s1.ms_heap == s2.ms_heap) /\ (s1.ms_stack == s2.ms_stack) /\ (s1.ms_stackTaint == s2.ms_stackTaint) (** Same as [equiv_states] but uses extensionality to "think harder"; useful at lower-level details of the proof. *) let equiv_states_ext (s1 s2 : machine_state) : GTot Type0 = let open FStar.FunctionalExtensionality in (feq s1.ms_regs s2.ms_regs) /\ (s1.ms_heap == s2.ms_heap) /\ (Map.equal s1.ms_stack.stack_mem s2.ms_stack.stack_mem) /\ (Map.equal s1.ms_stackTaint s2.ms_stackTaint) /\ (equiv_states s1 s2) (** A weaker version of [equiv_states] that makes all non-ok states equivalent. Since non-ok states indicate something "gone-wrong" in execution, we can safely say that the rest of the state is irrelevant. *) let equiv_states_or_both_not_ok (s1 s2:machine_state) = (equiv_states s1 s2) \/ ((not s1.ms_ok) /\ (not s2.ms_ok)) (** Convenience wrapper around [equiv_states] *) unfold let equiv_ostates (s1 s2 : option machine_state) : GTot Type0 = (Some? s1 = Some? s2) /\ (Some? s1 ==> (equiv_states (Some?.v s1) (Some?.v s2))) (** An [option state] is said to be erroring if it is either [None] or if it is [Some] but is not ok. *) unfold let erroring_option_state (s:option machine_state) = match s with | None -> true | Some s -> not (s.ms_ok) (** [equiv_option_states s1 s2] means that [s1] and [s2] are equivalent [option machine_state]s iff both have same erroring behavior and if they are non-erroring, they are [equiv_states]. *) unfold let equiv_option_states (s1 s2:option machine_state) = (erroring_option_state s1 == erroring_option_state s2) /\ (not (erroring_option_state s1) ==> equiv_states (Some?.v s1) (Some?.v s2)) /// If evaluation starts from a set of equivalent states, and the /// exact same thing is evaluated, then the final states are still /// equivalent. unfold let proof_run (s:machine_state) (f:st unit) : machine_state = let (), s1 = f s in { s1 with ms_ok = s1.ms_ok && s.ms_ok } let rec lemma_instr_apply_eval_args_equiv_states (outs:list instr_out) (args:list instr_operand) (f:instr_args_t outs args) (oprs:instr_operands_t_args args) (s1 s2:machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( (instr_apply_eval_args outs args f oprs s1) == (instr_apply_eval_args outs args f oprs s2))) = match args with | [] -> () | i :: args -> let (v, oprs) : option (instr_val_t i) & _ = match i with | IOpEx i -> let oprs = coerce oprs in (instr_eval_operand_explicit i (fst oprs) s1, snd oprs) | IOpIm i -> (instr_eval_operand_implicit i s1, coerce oprs) in let f:arrow (instr_val_t i) (instr_args_t outs args) = coerce f in match v with | None -> () | Some v -> lemma_instr_apply_eval_args_equiv_states outs args (f v) oprs s1 s2 #push-options "--z3rlimit 10" let rec lemma_instr_apply_eval_inouts_equiv_states (outs inouts:list instr_out) (args:list instr_operand) (f:instr_inouts_t outs inouts args) (oprs:instr_operands_t inouts args) (s1 s2:machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( (instr_apply_eval_inouts outs inouts args f oprs s1) == (instr_apply_eval_inouts outs inouts args f oprs s2))) = match inouts with | [] -> lemma_instr_apply_eval_args_equiv_states outs args f oprs s1 s2 | (Out, i) :: inouts -> let oprs = match i with | IOpEx i -> snd #(instr_operand_t i) (coerce oprs) | IOpIm i -> coerce oprs in lemma_instr_apply_eval_inouts_equiv_states outs inouts args (coerce f) oprs s1 s2 | (InOut, i)::inouts -> let (v, oprs) : option (instr_val_t i) & _ = match i with | IOpEx i -> let oprs = coerce oprs in (instr_eval_operand_explicit i (fst oprs) s1, snd oprs) | IOpIm i -> (instr_eval_operand_implicit i s1, coerce oprs) in let f:arrow (instr_val_t i) (instr_inouts_t outs inouts args) = coerce f in match v with | None -> () | Some v -> lemma_instr_apply_eval_inouts_equiv_states outs inouts args (f v) oprs s1 s2 #pop-options #push-options "--z3rlimit 10 --max_fuel 1 --max_ifuel 0" let lemma_instr_write_output_implicit_equiv_states (i:instr_operand_implicit) (v:instr_val_t (IOpIm i)) (s_orig1 s1 s_orig2 s2:machine_state) : Lemma (requires ( (equiv_states s_orig1 s_orig2) /\ (equiv_states s1 s2))) (ensures ( (equiv_states (instr_write_output_implicit i v s_orig1 s1) (instr_write_output_implicit i v s_orig2 s2)))) = let snew1, snew2 = (instr_write_output_implicit i v s_orig1 s1), (instr_write_output_implicit i v s_orig2 s2) in assert (equiv_states_ext snew1 snew2) (* OBSERVE *) let lemma_instr_write_output_explicit_equiv_states (i:instr_operand_explicit) (v:instr_val_t (IOpEx i)) (o:instr_operand_t i) (s_orig1 s1 s_orig2 s2:machine_state) : Lemma (requires ( (equiv_states s_orig1 s_orig2) /\ (equiv_states s1 s2))) (ensures ( (equiv_states (instr_write_output_explicit i v o s_orig1 s1) (instr_write_output_explicit i v o s_orig2 s2)))) = let snew1, snew2 = (instr_write_output_explicit i v o s_orig1 s1), (instr_write_output_explicit i v o s_orig2 s2) in assert (equiv_states_ext snew1 snew2) (* OBSERVE *) #pop-options let rec lemma_instr_write_outputs_equiv_states (outs:list instr_out) (args:list instr_operand) (vs:instr_ret_t outs) (oprs:instr_operands_t outs args) (s_orig1 s1:machine_state) (s_orig2 s2:machine_state) : Lemma (requires ( (equiv_states s_orig1 s_orig2) /\ (equiv_states s1 s2))) (ensures ( (equiv_states (instr_write_outputs outs args vs oprs s_orig1 s1) (instr_write_outputs outs args vs oprs s_orig2 s2)))) = match outs with | [] -> () | (_, i)::outs -> ( let ((v:instr_val_t i), (vs:instr_ret_t outs)) = match outs with | [] -> (vs, ()) | _::_ -> let vs = coerce vs in (fst vs, snd vs) in match i with | IOpEx i -> let oprs = coerce oprs in lemma_instr_write_output_explicit_equiv_states i v (fst oprs) s_orig1 s1 s_orig2 s2; let s1 = instr_write_output_explicit i v (fst oprs) s_orig1 s1 in let s2 = instr_write_output_explicit i v (fst oprs) s_orig2 s2 in lemma_instr_write_outputs_equiv_states outs args vs (snd oprs) s_orig1 s1 s_orig2 s2 | IOpIm i -> lemma_instr_write_output_implicit_equiv_states i v s_orig1 s1 s_orig2 s2; let s1 = instr_write_output_implicit i v s_orig1 s1 in let s2 = instr_write_output_implicit i v s_orig2 s2 in lemma_instr_write_outputs_equiv_states outs args vs (coerce oprs) s_orig1 s1 s_orig2 s2 ) let lemma_eval_instr_equiv_states (it:instr_t_record) (oprs:instr_operands_t it.outs it.args) (ann:instr_annotation it) (s1 s2:machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( equiv_ostates (eval_instr it oprs ann s1) (eval_instr it oprs ann s2))) = let InstrTypeRecord #outs #args #havoc_flags' i = it in let vs1 = instr_apply_eval outs args (instr_eval i) oprs s1 in let vs2 = instr_apply_eval outs args (instr_eval i) oprs s2 in lemma_instr_apply_eval_inouts_equiv_states outs outs args (instr_eval i) oprs s1 s2; assert (vs1 == vs2); let s1_new = match havoc_flags' with | HavocFlags -> {s1 with ms_flags = havoc_flags} | PreserveFlags -> s1 in let s2_new = match havoc_flags' with | HavocFlags -> {s2 with ms_flags = havoc_flags} | PreserveFlags -> s2 in assert (overflow s1_new.ms_flags == overflow s2_new.ms_flags); assert (cf s1_new.ms_flags == cf s2_new.ms_flags); assert (equiv_states s1_new s2_new); let os1 = FStar.Option.mapTot (fun vs -> instr_write_outputs outs args vs oprs s1 s1_new) vs1 in let os2 = FStar.Option.mapTot (fun vs -> instr_write_outputs outs args vs oprs s2 s2_new) vs2 in match vs1 with | None -> () | Some vs -> lemma_instr_write_outputs_equiv_states outs args vs oprs s1 s1_new s2 s2_new #push-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 1" (* REVIEW: This proof is INSANELY annoying to deal with due to the [Pop]. TODO: Figure out why it is slowing down so much. It practically brings F* to a standstill even when editing, and it acts worse during an interactive proof. *) let lemma_machine_eval_ins_st_equiv_states (i : ins) (s1 s2 : machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( equiv_states (run (machine_eval_ins_st i) s1) (run (machine_eval_ins_st i) s2))) = let s1_orig, s2_orig = s1, s2 in let s1_final = run (machine_eval_ins_st i) s1 in let s2_final = run (machine_eval_ins_st i) s2 in match i with | Instr it oprs ann -> lemma_eval_instr_equiv_states it oprs ann s1 s2 | Push _ _ -> assert_spinoff (equiv_states_ext s1_final s2_final) | Pop dst t -> let stack_op = OStack (MReg (Reg 0 rRsp) 0, t) in let s1 = proof_run s1 (check (valid_src_operand64_and_taint stack_op)) in let s2 = proof_run s2 (check (valid_src_operand64_and_taint stack_op)) in // assert (equiv_states s1 s2); let new_dst1 = eval_operand stack_op s1 in let new_dst2 = eval_operand stack_op s2 in // assert (new_dst1 == new_dst2); let new_rsp1 = (eval_reg_64 rRsp s1 + 8) % pow2_64 in let new_rsp2 = (eval_reg_64 rRsp s2 + 8) % pow2_64 in // assert (new_rsp1 == new_rsp2); let s1 = proof_run s1 (update_operand64_preserve_flags dst new_dst1) in let s2 = proof_run s2 (update_operand64_preserve_flags dst new_dst2) in assert (equiv_states_ext s1 s2); let s1 = proof_run s1 (free_stack (new_rsp1 - 8) new_rsp1) in let s2 = proof_run s2 (free_stack (new_rsp2 - 8) new_rsp2) in // assert (equiv_states s1 s2); let s1 = proof_run s1 (update_rsp new_rsp1) in let s2 = proof_run s2 (update_rsp new_rsp2) in assert (equiv_states_ext s1 s2); assert_spinoff (equiv_states s1_final s2_final) | Alloc _ -> assert_spinoff (equiv_states_ext s1_final s2_final) | Dealloc _ -> assert_spinoff (equiv_states_ext s1_final s2_final) #pop-options let lemma_eval_ins_equiv_states (i : ins) (s1 s2 : machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( equiv_states (machine_eval_ins i s1) (machine_eval_ins i s2))) = lemma_machine_eval_ins_st_equiv_states i s1 s2 (** Filter out observation related stuff from the state. *) let filt_state (s:machine_state) = { s with ms_trace = [] } #push-options "--z3rlimit 10 --max_fuel 1 --max_ifuel 1" let rec lemma_eval_code_equiv_states (c : code) (fuel:nat) (s1 s2 : machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( let s1'', s2'' = machine_eval_code c fuel s1, machine_eval_code c fuel s2 in equiv_ostates s1'' s2'')) (decreases %[fuel; c]) = match c with | Ins ins -> reveal_opaque (`%machine_eval_code_ins) machine_eval_code_ins; lemma_eval_ins_equiv_states ins (filt_state s1) (filt_state s2) | Block l -> lemma_eval_codes_equiv_states l fuel s1 s2 | IfElse ifCond ifTrue ifFalse -> reveal_opaque (`%valid_ocmp_opaque) valid_ocmp_opaque; reveal_opaque (`%eval_ocmp_opaque) eval_ocmp_opaque; let (s1', b1) = machine_eval_ocmp s1 ifCond in let (s2', b2) = machine_eval_ocmp s2 ifCond in assert (b1 == b2); assert (equiv_states s1' s2'); if b1 then ( lemma_eval_code_equiv_states ifTrue fuel s1' s2' ) else ( lemma_eval_code_equiv_states ifFalse fuel s1' s2' ) | While cond body -> lemma_eval_while_equiv_states cond body fuel s1 s2 and lemma_eval_codes_equiv_states (cs : codes) (fuel:nat) (s1 s2 : machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( let s1'', s2'' = machine_eval_codes cs fuel s1, machine_eval_codes cs fuel s2 in equiv_ostates s1'' s2'')) (decreases %[fuel; cs]) = match cs with | [] -> () | c :: cs -> lemma_eval_code_equiv_states c fuel s1 s2; let s1'', s2'' = machine_eval_code c fuel s1, machine_eval_code c fuel s2 in match s1'' with | None -> () | _ -> let Some s1, Some s2 = s1'', s2'' in lemma_eval_codes_equiv_states cs fuel s1 s2 and lemma_eval_while_equiv_states (cond:ocmp) (body:code) (fuel:nat) (s1 s2:machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( equiv_ostates (machine_eval_while cond body fuel s1) (machine_eval_while cond body fuel s2))) (decreases %[fuel; body]) = if fuel = 0 then () else ( reveal_opaque (`%valid_ocmp_opaque) valid_ocmp_opaque; reveal_opaque (`%eval_ocmp_opaque) eval_ocmp_opaque; let (s1, b1) = machine_eval_ocmp s1 cond in let (s2, b2) = machine_eval_ocmp s2 cond in assert (equiv_states s1 s2); assert (b1 == b2); if not b1 then () else ( assert (equiv_states s1 s2); let s_opt1 = machine_eval_code body (fuel - 1) s1 in let s_opt2 = machine_eval_code body (fuel - 1) s2 in lemma_eval_code_equiv_states body (fuel - 1) s1 s2; assert (equiv_ostates s_opt1 s_opt2); match s_opt1 with | None -> () | Some _ -> let Some s1, Some s2 = s_opt1, s_opt2 in if s1.ms_ok then ( lemma_eval_while_equiv_states cond body (fuel - 1) s1 s2 ) else () ) ) #pop-options /// If an exchange is allowed between two instructions based off of /// their read/write sets, then both orderings of the two instructions /// behave exactly the same, as per the previously defined /// [equiv_states] relation. /// /// Note that we require (for the overall proof) a notion of the /// following: /// /// s1 ===== s2 Key: /// | | /// . . + s1, s2, ... : machine_states /// . f1 . f2 + f1, f2 : some function from a /// . . machine_state to a /// | | machine_state /// V V + ===== : equiv_states /// s1' ===== s2' /// /// However, proving with the [equiv_states s1 s2] as part of the /// preconditions requires come complex wrangling and thinking about /// how different states [s1] and [s2] evolve. In particular, we'd /// need to show and write something similar _every_ step of the /// execution of [f1] and [f2]. Instead, we decompose the above /// diagram into the following: /// /// /// s1 ===== s2 /// / \ \ /// . . . /// . f1 . f2 . f2 /// . . . /// / \ \ /// V V V /// s1' ===== s2''===== s2' /// /// /// We now have the ability to decompose the left "triangular" portion /// which is similar to the rectangular diagram above, except the /// issue of having to manage both [s1] and [s2] is mitigated. Next, /// if we look at the right "parallelogram" portion of the diagram, we /// see that this is just the same as saying "running [f2] on /// [equiv_states] leads to [equiv_states]" which is something that is /// easier to prove. /// /// All the parallelogram proofs have already been completed by this /// point in the file, so only the triangular portions remain (and the /// one proof that links the two up into a single diagram as above). unfold let run2 (f1 f2:st unit) (s:machine_state) : machine_state = let open Vale.X64.Machine_Semantics_s in run (f1;* f2;* return ()) s let commutes (s:machine_state) (f1 f2:st unit) : GTot Type0 = equiv_states_or_both_not_ok (run2 f1 f2 s) (run2 f2 f1 s) let rec lemma_disjoint_implies_unchanged_at (reads changes:list location) (s1 s2:machine_state) : Lemma (requires (!!(disjoint_locations reads changes) /\ unchanged_except changes s1 s2)) (ensures (unchanged_at reads s1 s2)) = match reads with | [] -> () | x :: xs -> lemma_disjoint_implies_unchanged_at xs changes s1 s2 let rec lemma_disjoint_location_from_locations_append (a:location) (as1 as2:list location) : Lemma ( (!!(disjoint_location_from_locations a as1) /\ !!(disjoint_location_from_locations a as2)) <==> (!!(disjoint_location_from_locations a (as1 `L.append` as2)))) = match as1 with | [] -> () | x :: xs -> lemma_disjoint_location_from_locations_append a xs as2 let lemma_unchanged_except_transitive (a12 a23:list location) (s1 s2 s3:machine_state) : Lemma (requires (unchanged_except a12 s1 s2 /\ unchanged_except a23 s2 s3)) (ensures (unchanged_except (a12 `L.append` a23) s1 s3)) = let aux a : Lemma (requires (!!(disjoint_location_from_locations a (a12 `L.append` a23)))) (ensures (eval_location a s1 == eval_location a s3)) = lemma_disjoint_location_from_locations_append a a12 a23 in FStar.Classical.forall_intro (FStar.Classical.move_requires aux) let lemma_unchanged_except_append_symmetric (a1 a2:list location) (s1 s2:machine_state) : Lemma (requires (unchanged_except (a1 `L.append` a2) s1 s2)) (ensures (unchanged_except (a2 `L.append` a1) s1 s2)) = let aux a : Lemma (requires ( (!!(disjoint_location_from_locations a (a1 `L.append` a2))) \/ (!!(disjoint_location_from_locations a (a2 `L.append` a1))))) (ensures (eval_location a s1 == eval_location a s2)) = lemma_disjoint_location_from_locations_append a a1 a2; lemma_disjoint_location_from_locations_append a a2 a1 in FStar.Classical.forall_intro (FStar.Classical.move_requires aux) #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_disjoint_location_from_locations_mem (a1 a2:list location) (a:location) : Lemma (requires ( (L.mem a a1) /\ !!(disjoint_locations a1 a2))) (ensures ( !!(disjoint_location_from_locations a a2))) = match a1 with | [_] -> () | x :: xs -> if a = x then () else lemma_disjoint_location_from_locations_mem xs a2 a #pop-options #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_constant_on_execution_mem (locv:locations_with_values) (f:st unit) (s:machine_state) (l:location_eq) (v:location_val_eqt l) : Lemma (requires ( (constant_on_execution locv f s) /\ ((run f s).ms_ok) /\ ((| l, v |) `L.mem` locv))) (ensures ( (eval_location l (run f s) == raise_location_val_eqt v))) = match locv with | [_] -> () | x :: xs -> if x = (| l, v |) then () else ( lemma_constant_on_execution_mem xs f s l v ) #pop-options let rec lemma_disjoint_location_from_locations_mem1 (a:location) (as0:locations) : Lemma (requires (not (L.mem a as0))) (ensures (!!(disjoint_location_from_locations a as0))) = match as0 with | [] -> () | x :: xs -> lemma_disjoint_location_from_locations_mem1 a xs let rec value_of_const_loc (lv:locations_with_values) (l:location_eq{ L.mem l (locations_of_locations_with_values lv) }) : location_val_eqt l = let x :: xs = lv in if dfst x = l then dsnd x else value_of_const_loc xs l let rec lemma_write_same_constants_append (c1 c1' c2:locations_with_values) : Lemma (ensures ( !!(write_same_constants (c1 `L.append` c1') c2) = ( !!(write_same_constants c1 c2) && !!(write_same_constants c1' c2)))) = match c1 with | [] -> () | x :: xs -> lemma_write_same_constants_append xs c1' c2 let rec lemma_write_same_constants_mem_both (c1 c2:locations_with_values) (l:location_eq) : Lemma (requires (!!(write_same_constants c1 c2) /\ L.mem l (locations_of_locations_with_values c1) /\ L.mem l (locations_of_locations_with_values c2))) (ensures (value_of_const_loc c1 l = value_of_const_loc c2 l)) = let x :: xs = c1 in let y :: ys = c2 in if dfst x = l then ( if dfst y = l then () else ( lemma_write_same_constants_symmetric c1 c2; lemma_write_same_constants_symmetric ys c1; lemma_write_same_constants_mem_both c1 ys l ) ) else ( lemma_write_same_constants_mem_both xs c2 l ) let rec lemma_value_of_const_loc_mem (c:locations_with_values) (l:location_eq) (v:location_val_eqt l) : Lemma (requires ( L.mem l (locations_of_locations_with_values c) /\ value_of_const_loc c l = v)) (ensures (L.mem (|l,v|) c)) = let x :: xs = c in if dfst x = l then () else lemma_value_of_const_loc_mem xs l v #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_unchanged_at_mem (as0:list location) (a:location) (s1 s2:machine_state) : Lemma (requires ( (unchanged_at as0 s1 s2) /\ (L.mem a as0))) (ensures ( (eval_location a s1 == eval_location a s2))) = match as0 with | [_] -> () | x :: xs -> if a = x then () else lemma_unchanged_at_mem xs a s1 s2 #pop-options let lemma_unchanged_at_combine (a1 a2:locations) (c1 c2:locations_with_values) (sa1 sa2 sb1 sb2:machine_state) : Lemma (requires ( !!(write_exchange_allowed a1 a2 c1 c2) /\ (unchanged_at (locations_of_locations_with_values c1) sb1 sb2) /\ (unchanged_at (locations_of_locations_with_values c2) sb1 sb2) /\ (unchanged_at a1 sa1 sb2) /\ (unchanged_except a2 sa1 sb1) /\ (unchanged_at a2 sa2 sb1) /\ (unchanged_except a1 sa2 sb2))) (ensures ( (unchanged_at (a1 `L.append` a2) sb1 sb2))) = let precond = !!(write_exchange_allowed a1 a2 c1 c2) /\ (unchanged_at (locations_of_locations_with_values c1) sb1 sb2) /\ (unchanged_at (locations_of_locations_with_values c2) sb1 sb2) /\ (unchanged_at a1 sa1 sb2) /\ (unchanged_except a2 sa1 sb1) /\ (unchanged_at a2 sa2 sb1) /\ (unchanged_except a1 sa2 sb2) in let aux1 a : Lemma (requires (L.mem a a1 /\ precond)) (ensures (eval_location a sb1 == eval_location a sb2)) = if L.mem a (locations_of_locations_with_values c1) then ( lemma_unchanged_at_mem (locations_of_locations_with_values c1) a sb1 sb2 ) else ( lemma_for_all_elim (aux_write_exchange_allowed a2 c1 c2) a1; L.mem_memP a a1; assert !!(aux_write_exchange_allowed a2 c1 c2 a); assert !!(disjoint_location_from_locations a a2); assert (eval_location a sb1 == eval_location a sa1); lemma_unchanged_at_mem a1 a sa1 sb2 ) in let aux2 a : Lemma (requires (L.mem a a2 /\ precond)) (ensures (eval_location a sb1 == eval_location a sb2)) = if L.mem a (locations_of_locations_with_values c2) then ( lemma_unchanged_at_mem (locations_of_locations_with_values c2) a sb1 sb2 ) else ( lemma_write_exchange_allowed_symmetric a1 a2 c1 c2; lemma_for_all_elim (aux_write_exchange_allowed a1 c2 c1) a2; L.mem_memP a a2; assert !!(aux_write_exchange_allowed a1 c2 c1 a); assert !!(disjoint_location_from_locations a a1); assert (eval_location a sb2 == eval_location a sa2); lemma_unchanged_at_mem a2 a sa2 sb1 ) in let rec aux a1' a1'' a2' a2'' : Lemma (requires (a1' `L.append` a1'' == a1 /\ a2' `L.append` a2'' == a2 /\ precond)) (ensures (unchanged_at (a1'' `L.append` a2'') sb1 sb2)) (decreases %[a1''; a2'']) = match a1'' with | [] -> ( match a2'' with | [] -> () | y :: ys -> ( L.append_l_cons y ys a2'; L.append_mem a2' a2'' y; aux2 y; aux a1' a1'' (a2' `L.append` [y]) ys ) ) | x :: xs -> L.append_l_cons x xs a1'; L.append_mem a1' a1'' x; aux1 x; aux (a1' `L.append` [x]) xs a2' a2'' in aux [] a1 [] a2 let lemma_unchanged_except_same_transitive (as0:list location) (s1 s2 s3:machine_state) : Lemma (requires ( (unchanged_except as0 s1 s2) /\ (unchanged_except as0 s2 s3))) (ensures ( (unchanged_except as0 s1 s3))) = () let rec lemma_unchanged_at_and_except (as0:list location) (s1 s2:machine_state) : Lemma (requires ( (unchanged_at as0 s1 s2) /\ (unchanged_except as0 s1 s2))) (ensures ( (unchanged_except [] s1 s2))) = match as0 with | [] -> () | x :: xs -> lemma_unchanged_at_and_except xs s1 s2 let lemma_equiv_states_when_except_none (s1 s2:machine_state) (ok:bool) : Lemma (requires ( (unchanged_except [] s1 s2))) (ensures ( (equiv_states ({s1 with ms_ok=ok}) ({s2 with ms_ok=ok})))) = assert_norm (cf s2.ms_flags == cf (filter_state s2 s1.ms_flags ok []).ms_flags); (* OBSERVE *) assert_norm (overflow s2.ms_flags == overflow (filter_state s2 s1.ms_flags ok []).ms_flags); (* OBSERVE *) lemma_locations_complete s1 s2 s1.ms_flags ok [] #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_mem_not_disjoint (a:location) (as1 as2:list location) : Lemma (requires (L.mem a as1 /\ L.mem a as2)) (ensures ( (not !!(disjoint_locations as1 as2)))) = match as1, as2 with | [_], [_] -> () | [_], y :: ys -> if a = y then () else ( lemma_mem_not_disjoint a as1 ys ) | x :: xs, y :: ys -> if a = x then ( if a = y then () else ( lemma_mem_not_disjoint a as1 ys; lemma_disjoint_locations_symmetric as1 as2; lemma_disjoint_locations_symmetric as1 ys ) ) else ( lemma_mem_not_disjoint a xs as2 ) #pop-options let lemma_bounded_effects_means_same_ok (rw:rw_set) (f:st unit) (s1 s2 s1' s2':machine_state) : Lemma (requires ( (bounded_effects rw f) /\ (s1.ms_ok = s2.ms_ok) /\ (unchanged_at rw.loc_reads s1 s2) /\ (s1' == run f s1) /\ (s2' == run f s2))) (ensures ( ((run f s1).ms_ok = (run f s2).ms_ok))) = () let lemma_both_not_ok (f1 f2:st unit) (rw1 rw2:rw_set) (s:machine_state) : Lemma (requires ( (bounded_effects rw1 f1) /\ (bounded_effects rw2 f2) /\ !!(rw_exchange_allowed rw1 rw2))) (ensures ( (run2 f1 f2 s).ms_ok = (run2 f2 f1 s).ms_ok)) = if (run f1 s).ms_ok then ( lemma_disjoint_implies_unchanged_at rw2.loc_reads rw1.loc_writes s (run f1 s) ) else (); if (run f2 s).ms_ok then ( lemma_disjoint_implies_unchanged_at rw1.loc_reads rw2.loc_writes s (run f2 s) ) else () #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let lemma_constant_on_execution_stays_constant (f1 f2:st unit) (rw1 rw2:rw_set) (s s1 s2:machine_state) : Lemma (requires ( s1.ms_ok /\ s2.ms_ok /\ (run f1 s1).ms_ok /\ (run f2 s2).ms_ok /\ (bounded_effects rw1 f1) /\ (bounded_effects rw2 f2) /\ (s1 == run f2 s) /\ (s2 == run f1 s) /\ !!(write_exchange_allowed rw1.loc_writes rw2.loc_writes rw1.loc_constant_writes rw2.loc_constant_writes))) (ensures ( unchanged_at (locations_of_locations_with_values rw1.loc_constant_writes) (run f1 s1) (run f2 s2) /\ unchanged_at (locations_of_locations_with_values rw2.loc_constant_writes) (run f1 s1) (run f2 s2))) = let precond = s1.ms_ok /\ s2.ms_ok /\ (run f1 s1).ms_ok /\ (run f2 s2).ms_ok /\ (bounded_effects rw1 f1) /\ (bounded_effects rw2 f2) /\ (s1 == run f2 s) /\ (s2 == run f1 s) /\ !!(write_exchange_allowed rw1.loc_writes rw2.loc_writes rw1.loc_constant_writes rw2.loc_constant_writes) in let r1, w1, c1 = rw1.loc_reads, rw1.loc_writes, rw1.loc_constant_writes in let r2, w2, c2 = rw2.loc_reads, rw2.loc_writes, rw2.loc_constant_writes in let cv1, cv2 = locations_of_locations_with_values rw1.loc_constant_writes, locations_of_locations_with_values rw2.loc_constant_writes in let rec aux1 lv lv' : Lemma (requires ( (precond) /\ lv `L.append` lv' == c1)) (ensures ( (unchanged_at (locations_of_locations_with_values lv') (run f1 s1) (run f2 s2)))) (decreases %[lv']) = match lv' with | [] -> () | x :: xs -> let (|l,v|) = x in L.append_mem lv lv' x; lemma_constant_on_execution_mem (lv `L.append` lv') f1 s1 l v; lemma_for_all_elim (aux_write_exchange_allowed w2 c1 c2) w1; assert (eval_location l (run f1 s1) == raise_location_val_eqt v); if L.mem l w2 then ( L.mem_memP l w1; assert !!(aux_write_exchange_allowed w2 c1 c2 l); lemma_mem_not_disjoint l [l] w2; assert (not !!(disjoint_location_from_locations l w2)); //assert (L.mem (coerce l) cv2); assert !!(write_same_constants c1 c2); assert (value_of_const_loc lv' l = v); lemma_write_same_constants_append lv lv' c2; lemma_write_same_constants_mem_both lv' c2 l; lemma_value_of_const_loc_mem c2 l v; lemma_constant_on_execution_mem c2 f2 s2 l v ) else ( assert (constant_on_execution c1 f1 s); lemma_constant_on_execution_mem (lv `L.append` lv') f1 s l v; assert (eval_location l (run f1 s) == raise_location_val_eqt v); assert (unchanged_except w2 s2 (run f2 s2)); lemma_disjoint_location_from_locations_mem1 l w2; assert (!!(disjoint_location_from_locations l w2)); assert (eval_location l (run f2 s2) == raise_location_val_eqt v) ); L.append_l_cons x xs lv; aux1 (lv `L.append` [x]) xs in let rec aux2 lv lv' : Lemma (requires ( (precond) /\ lv `L.append` lv' == c2)) (ensures ( (unchanged_at (locations_of_locations_with_values lv') (run f1 s1) (run f2 s2)))) (decreases %[lv']) = match lv' with | [] -> () | x :: xs -> let (|l,v|) = x in L.append_mem lv lv' x; lemma_constant_on_execution_mem (lv `L.append` lv') f2 s2 l v; lemma_write_exchange_allowed_symmetric w1 w2 c1 c2; lemma_for_all_elim (aux_write_exchange_allowed w1 c2 c1) w2; assert (eval_location l (run f2 s2) == raise_location_val_eqt v); if L.mem l w1 then ( L.mem_memP l w2; assert !!(aux_write_exchange_allowed w1 c2 c1 l); lemma_mem_not_disjoint l [l] w1; assert (not !!(disjoint_location_from_locations l w1)); //assert (L.mem (coerce l) cv1); assert !!(write_same_constants c2 c1); assert (value_of_const_loc lv' l = v); lemma_write_same_constants_append lv lv' c1; lemma_write_same_constants_mem_both lv' c1 l; lemma_value_of_const_loc_mem c1 l v; lemma_constant_on_execution_mem c1 f1 s1 l v ) else ( assert (constant_on_execution c2 f2 s); lemma_constant_on_execution_mem (lv `L.append` lv') f2 s l v; assert (eval_location l (run f2 s) == raise_location_val_eqt v); assert (unchanged_except w1 s1 (run f1 s1)); lemma_disjoint_location_from_locations_mem1 l w1; assert (!!(disjoint_location_from_locations l w1)); assert (eval_location l (run f1 s1) == raise_location_val_eqt v) ); L.append_l_cons x xs lv; aux2 (lv `L.append` [x]) xs in aux1 [] c1; aux2 [] c2 #pop-options let lemma_commute (f1 f2:st unit) (rw1 rw2:rw_set) (s:machine_state) : Lemma (requires ( (bounded_effects rw1 f1) /\ (bounded_effects rw2 f2) /\ !!(rw_exchange_allowed rw1 rw2))) (ensures ( equiv_states_or_both_not_ok (run2 f1 f2 s) (run2 f2 f1 s))) = let s12 = run2 f1 f2 s in let s21 = run2 f2 f1 s in if not s12.ms_ok || not s21.ms_ok then ( lemma_both_not_ok f1 f2 rw1 rw2 s ) else ( let s1 = run f1 s in let s2 = run f2 s in let r1, w1, c1 = rw1.loc_reads, rw1.loc_writes, rw1.loc_constant_writes in let r2, w2, c2 = rw2.loc_reads, rw2.loc_writes, rw2.loc_constant_writes in assert (s12 == run f2 s1 /\ s21 == run f1 s2); lemma_disjoint_implies_unchanged_at r1 w2 s s2; lemma_disjoint_implies_unchanged_at r2 w1 s s1; assert (unchanged_at w1 s1 s21); assert (unchanged_at w2 s2 s12); assert (unchanged_except w2 s s2); assert (unchanged_except w1 s s1); assert (unchanged_except w2 s1 s12); assert (unchanged_except w1 s2 s21); lemma_unchanged_except_transitive w1 w2 s s1 s12; assert (unchanged_except (w1 `L.append` w2) s s12); lemma_unchanged_except_transitive w2 w1 s s2 s21; assert (unchanged_except (w2 `L.append` w1) s s21); lemma_unchanged_except_append_symmetric w1 w2 s s12; lemma_unchanged_except_append_symmetric w2 w1 s s21; lemma_unchanged_except_same_transitive (w1 `L.append` w2) s s12 s21; lemma_write_exchange_allowed_symmetric w1 w2 c1 c2; lemma_constant_on_execution_stays_constant f2 f1 rw2 rw1 s s1 s2; lemma_unchanged_at_combine w1 w2 c1 c2 s1 s2 s12 s21; lemma_unchanged_at_and_except (w1 `L.append` w2) s12 s21; assert (unchanged_except [] s12 s21); assert (s21.ms_ok = s12.ms_ok); lemma_equiv_states_when_except_none s12 s21 s12.ms_ok; assert (equiv_states (run2 f1 f2 s) (run2 f2 f1 s)) ) let wrap_ss (f:machine_state -> machine_state) : st unit = let open Vale.X64.Machine_Semantics_s in let* s = get in set (f s) let wrap_sos (f:machine_state -> option machine_state) : st unit = fun s -> ( match f s with | None -> (), { s with ms_ok = false } | Some s' -> (), s' ) let lemma_feq_bounded_effects (rw:rw_set) (f1 f2:st unit) : Lemma (requires (bounded_effects rw f1 /\ FStar.FunctionalExtensionality.feq f1 f2)) (ensures (bounded_effects rw f2)) = let open FStar.FunctionalExtensionality in assert (only_affects rw.loc_writes f2); let rec aux w s : Lemma (requires (feq f1 f2 /\ constant_on_execution w f1 s)) (ensures (constant_on_execution w f2 s)) [SMTPat (constant_on_execution w f2 s)] = match w with | [] -> () | x :: xs -> aux xs s in assert (forall s. {:pattern (constant_on_execution rw.loc_constant_writes f2 s)} constant_on_execution rw.loc_constant_writes f2 s); assert (forall l v. {:pattern (L.mem (|l,v|) rw.loc_constant_writes); (L.mem l rw.loc_writes)} L.mem (|l,v|) rw.loc_constant_writes ==> L.mem l rw.loc_writes); assert ( forall s1 s2. {:pattern (run f2 s1); (run f2 s2)} ( (s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2) ==> ( ((run f2 s1).ms_ok = (run f2 s2).ms_ok) /\ ((run f2 s1).ms_ok ==> unchanged_at rw.loc_writes (run f2 s1) (run f2 s2)) ) ) ) let rec safely_bounded_code_p (c:code) : bool = match c with | Ins i -> safely_bounded i | Block l -> safely_bounded_codes_p l | IfElse c t f -> false (* Temporarily disabled. TODO: Re-enable this. safely_bounded_code_p t && safely_bounded_code_p f *) | While c b -> false (* Temporarily disabled. TODO: Re-enable this. safely_bounded_code_p b *) and safely_bounded_codes_p (l:codes) : bool = match l with | [] -> true | x :: xs -> safely_bounded_code_p x && safely_bounded_codes_p xs type safely_bounded_ins = (i:ins{safely_bounded i}) type safely_bounded_code = (c:code{safely_bounded_code_p c}) type safely_bounded_codes = (c:codes{safely_bounded_codes_p c}) let lemma_machine_eval_ins_bounded_effects (i:safely_bounded_ins) : Lemma (ensures (bounded_effects (rw_set_of_ins i) (wrap_ss (machine_eval_ins i)))) = lemma_machine_eval_ins_st_bounded_effects i; lemma_feq_bounded_effects (rw_set_of_ins i) (machine_eval_ins_st i) (wrap_ss (machine_eval_ins i)) let lemma_machine_eval_ins_st_exchange (i1 i2 : ins) (s : machine_state) : Lemma (requires (!!(ins_exchange_allowed i1 i2))) (ensures (commutes s (machine_eval_ins_st i1) (machine_eval_ins_st i2))) = lemma_machine_eval_ins_st_bounded_effects i1; lemma_machine_eval_ins_st_bounded_effects i2; let rw1 = rw_set_of_ins i1 in let rw2 = rw_set_of_ins i2 in lemma_commute (machine_eval_ins_st i1) (machine_eval_ins_st i2) rw1 rw2 s let lemma_instruction_exchange' (i1 i2 : ins) (s1 s2 : machine_state) : Lemma (requires ( !!(ins_exchange_allowed i1 i2) /\ (equiv_states s1 s2))) (ensures ( (let s1', s2' = machine_eval_ins i2 (machine_eval_ins i1 s1), machine_eval_ins i1 (machine_eval_ins i2 s2) in equiv_states_or_both_not_ok s1' s2'))) = lemma_machine_eval_ins_st_exchange i1 i2 s1; lemma_eval_ins_equiv_states i2 s1 s2; lemma_eval_ins_equiv_states i1 (machine_eval_ins i2 s1) (machine_eval_ins i2 s2) let lemma_instruction_exchange (i1 i2 : ins) (s1 s2 : machine_state) : Lemma (requires ( !!(ins_exchange_allowed i1 i2) /\ (equiv_states s1 s2))) (ensures ( (let s1', s2' = machine_eval_ins i2 (filt_state (machine_eval_ins i1 (filt_state s1))), machine_eval_ins i1 (filt_state (machine_eval_ins i2 (filt_state s2))) in equiv_states_or_both_not_ok s1' s2'))) = lemma_eval_ins_equiv_states i1 s1 (filt_state s1); lemma_eval_ins_equiv_states i2 s2 (filt_state s2); lemma_eval_ins_equiv_states i2 (machine_eval_ins i1 (filt_state s1)) (filt_state (machine_eval_ins i1 (filt_state s1))); lemma_eval_ins_equiv_states i1 (machine_eval_ins i2 (filt_state s2)) (filt_state (machine_eval_ins i2 (filt_state s2))); lemma_eval_ins_equiv_states i2 (machine_eval_ins i1 s1) (machine_eval_ins i1 (filt_state s1)); lemma_eval_ins_equiv_states i1 (machine_eval_ins i2 s2) (machine_eval_ins i2 (filt_state s2)); lemma_instruction_exchange' i1 i2 s1 s2 /// Not-ok states lead to erroring states upon execution #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_not_ok_propagate_code (c:code) (fuel:nat) (s:machine_state) : Lemma (requires (not s.ms_ok)) (ensures (erroring_option_state (machine_eval_code c fuel s))) (decreases %[fuel; c; 1]) = match c with | Ins _ -> reveal_opaque (`%machine_eval_code_ins) machine_eval_code_ins | Block l -> lemma_not_ok_propagate_codes l fuel s | IfElse ifCond ifTrue ifFalse -> let (s', b) = machine_eval_ocmp s ifCond in if b then lemma_not_ok_propagate_code ifTrue fuel s' else lemma_not_ok_propagate_code ifFalse fuel s' | While _ _ -> lemma_not_ok_propagate_while c fuel s and lemma_not_ok_propagate_codes (l:codes) (fuel:nat) (s:machine_state) : Lemma (requires (not s.ms_ok)) (ensures (erroring_option_state (machine_eval_codes l fuel s))) (decreases %[fuel; l]) = match l with | [] -> () | x :: xs -> lemma_not_ok_propagate_code x fuel s; match machine_eval_code x fuel s with | None -> () | Some s -> lemma_not_ok_propagate_codes xs fuel s and lemma_not_ok_propagate_while (c:code{While? c}) (fuel:nat) (s:machine_state) : Lemma (requires (not s.ms_ok)) (ensures (erroring_option_state (machine_eval_code c fuel s))) (decreases %[fuel; c; 0]) = if fuel = 0 then () else ( let While cond body = c in let (s, b) = machine_eval_ocmp s cond in if not b then () else ( lemma_not_ok_propagate_code body (fuel - 1) s ) ) #pop-options /// Given that we have bounded instructions, we can compute bounds on /// [code] and [codes]. let rec rw_set_of_code (c:safely_bounded_code) : rw_set = match c with | Ins i -> rw_set_of_ins i | Block l -> rw_set_of_codes l | IfElse c t f -> add_r_to_rw_set (locations_of_ocmp c) (rw_set_in_parallel (rw_set_of_code t) (rw_set_of_code f)) | While c b -> { add_r_to_rw_set (locations_of_ocmp c) (rw_set_of_code b) with loc_constant_writes = [] (* Since the loop may not execute, we are not sure of any constant writes *) } and rw_set_of_codes (c:safely_bounded_codes) : rw_set = match c with | [] -> { loc_reads = []; loc_writes = []; loc_constant_writes = []; } | x :: xs -> rw_set_in_series (rw_set_of_code x) (rw_set_of_codes xs) let lemma_bounded_effects_on_functional_extensionality (rw:rw_set) (f1 f2:st unit) : Lemma (requires (FStar.FunctionalExtensionality.feq f1 f2 /\ bounded_effects rw f1)) (ensures (bounded_effects rw f2)) = let pre = FStar.FunctionalExtensionality.feq f1 f2 /\ bounded_effects rw f1 in assert (only_affects rw.loc_writes f1 <==> only_affects rw.loc_writes f2); let rec aux c s : Lemma (requires (pre /\ constant_on_execution c f1 s)) (ensures (constant_on_execution c f2 s)) = match c with | [] -> () | (|l,v|) :: xs -> aux xs s in let aux = FStar.Classical.move_requires (aux rw.loc_constant_writes) in FStar.Classical.forall_intro aux; let aux s1 s2 : Lemma (requires (pre /\ s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2 /\ (run f2 s1).ms_ok)) (ensures (unchanged_at rw.loc_writes (run f2 s1) (run f2 s2))) = () in let aux s1 = FStar.Classical.move_requires (aux s1) in FStar.Classical.forall_intro_2 aux let lemma_only_affects_to_unchanged_except locs f s : (* REVIEW: Why is this even needed?! *) Lemma (requires (only_affects locs f /\ (run f s).ms_ok)) (ensures (unchanged_except locs s (run f s))) = () let lemma_equiv_code_codes (c:code) (cs:codes) (fuel:nat) (s:machine_state) : Lemma (ensures ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in equiv_states_or_both_not_ok (run (f1;* f2) s) (run f12 s))) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let s_1 = run f1 s in let s_1_2 = run f2 s_1 in let s_12 = run (f1;* f2) s in let s12 = run f12 s in assert (s_12 == {s_1_2 with ms_ok = s.ms_ok && s_1.ms_ok && s_1_2.ms_ok}); if s.ms_ok then ( if s_1.ms_ok then () else ( lemma_not_ok_propagate_codes cs fuel s_1 ) ) else ( lemma_not_ok_propagate_code c fuel s; lemma_not_ok_propagate_codes cs fuel s_1; lemma_not_ok_propagate_codes (c :: cs) fuel s ) let lemma_bounded_effects_code_codes_aux1 (c:code) (cs:codes) (rw:rw_set) (fuel:nat) s a : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in (bounded_effects rw (f1 ;* f2)) /\ !!(disjoint_location_from_locations a rw.loc_writes) /\ (run f12 s).ms_ok)) (ensures ( let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in eval_location a s == eval_location a (run f12 s))) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = (f1;*f2) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let s_12 = run (f1;*f2) s in let s12 = run f12 s in lemma_equiv_code_codes c cs fuel s; assert (equiv_states_or_both_not_ok s_12 s12); lemma_only_affects_to_unchanged_except rw.loc_writes f s let rec lemma_bounded_effects_code_codes_aux2 (c:code) (cs:codes) (fuel:nat) cw s : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in (constant_on_execution cw (f1;*f2) s))) (ensures ( let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in (constant_on_execution cw f12 s))) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = (f1;*f2) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in lemma_equiv_code_codes c cs fuel s; if (run f s).ms_ok then ( match cw with | [] -> () | (|l, v|) :: xs -> ( lemma_bounded_effects_code_codes_aux2 c cs fuel xs s ) ) else () let lemma_unchanged_at_reads_implies_both_ok_equal (rw:rw_set) (f:st unit) s1 s2 : (* REVIEW: Why is this necessary?! *) Lemma (requires (bounded_effects rw f /\ s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2)) (ensures ( ((run f s1).ms_ok = (run f s2).ms_ok) /\ ((run f s1).ms_ok ==> unchanged_at rw.loc_writes (run f s1) (run f s2)))) = () let lemma_bounded_effects_code_codes_aux3 (c:code) (cs:codes) (rw:rw_set) (fuel:nat) s1 s2 : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in (bounded_effects rw (f1 ;* f2)) /\ s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2)) (ensures ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in (run f12 s1).ms_ok = (run f12 s2).ms_ok /\ (run (f1 ;* f2) s1).ms_ok = (run f12 s1).ms_ok)) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = (f1;*f2) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let pre = bounded_effects rw f in lemma_equiv_code_codes c cs fuel s1; lemma_equiv_code_codes c cs fuel s2; assert ((run f s1).ms_ok == (run f12 s1).ms_ok); assert ((run f s2).ms_ok == (run f12 s2).ms_ok); lemma_unchanged_at_reads_implies_both_ok_equal rw f s1 s2 let lemma_bounded_effects_code_codes_aux4 (c:code) (cs:codes) (rw:rw_set) (fuel:nat) s1 s2 : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in (bounded_effects rw (f1 ;* f2)) /\ s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2 /\ (run (f1 ;* f2) s1).ms_ok)) (ensures ( let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in unchanged_at rw.loc_writes (run f12 s1) (run f12 s2))) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = (f1;*f2) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let pre = bounded_effects rw f in lemma_equiv_code_codes c cs fuel s1; lemma_equiv_code_codes c cs fuel s2; lemma_unchanged_at_reads_implies_both_ok_equal rw f s1 s2; assert (run f12 s1).ms_ok; assert (run f12 s2).ms_ok; assert (unchanged_at rw.loc_writes (run f s1) (run f s2)); assert (run f s1 == run f12 s1); assert (run f s2 == run f12 s2) let lemma_bounded_effects_code_codes (c:code) (cs:codes) (rw:rw_set) (fuel:nat) : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in (bounded_effects rw (f1 ;* f2)))) (ensures ( let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in bounded_effects rw f12)) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = f1;*f2 in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let pre = bounded_effects rw f in let aux s = FStar.Classical.move_requires (lemma_bounded_effects_code_codes_aux1 c cs rw fuel s) in FStar.Classical.forall_intro_2 aux; let aux = FStar.Classical.move_requires (lemma_bounded_effects_code_codes_aux2 c cs fuel rw.loc_constant_writes) in FStar.Classical.forall_intro aux; let aux s1 = FStar.Classical.move_requires (lemma_bounded_effects_code_codes_aux3 c cs rw fuel s1) in FStar.Classical.forall_intro_2 aux; let aux s1 = FStar.Classical.move_requires (lemma_bounded_effects_code_codes_aux4 c cs rw fuel s1) in FStar.Classical.forall_intro_2 aux let rec lemma_bounded_code (c:safely_bounded_code) (fuel:nat) : Lemma (ensures (bounded_effects (rw_set_of_code c) (wrap_sos (machine_eval_code c fuel)))) (decreases %[c]) = match c with | Ins i -> reveal_opaque (`%machine_eval_code_ins) machine_eval_code_ins; lemma_machine_eval_code_Ins_bounded_effects i fuel; lemma_bounded_effects_on_functional_extensionality (rw_set_of_ins i) (fun s -> (), (Some?.v (machine_eval_code_ins_def i s))) (wrap_sos (machine_eval_code c fuel)) | Block l -> lemma_bounded_codes l fuel; lemma_bounded_effects_on_functional_extensionality (rw_set_of_codes l) (wrap_sos (machine_eval_codes l fuel)) (wrap_sos (machine_eval_code (Block l) fuel)) | IfElse c t f -> () | While c b -> () and lemma_bounded_codes (c:safely_bounded_codes) (fuel:nat) : Lemma (ensures (bounded_effects (rw_set_of_codes c) (wrap_sos (machine_eval_codes c fuel)))) (decreases %[c]) = let open Vale.X64.Machine_Semantics_s in match c with | [] -> () | x :: xs -> lemma_bounded_code x fuel; lemma_bounded_codes xs fuel; lemma_bounded_effects_series (rw_set_of_code x) (rw_set_of_codes xs) (wrap_sos (machine_eval_code x fuel)) (wrap_sos (machine_eval_codes xs fuel)); lemma_bounded_effects_code_codes x xs (rw_set_of_codes c) fuel /// Given that we can perform simple swaps between instructions, we /// can do swaps between [code]s. let code_exchange_allowed (c1 c2:safely_bounded_code) : pbool = rw_exchange_allowed (rw_set_of_code c1) (rw_set_of_code c2) /+> normal (" for instructions " ^ fst (print_code c1 0 gcc) ^ " and " ^ fst (print_code c2 0 gcc)) #push-options "--initial_fuel 3 --max_fuel 3 --initial_ifuel 0 --max_ifuel 0" let lemma_code_exchange_allowed (c1 c2:safely_bounded_code) (fuel:nat) (s:machine_state) : Lemma (requires ( !!(code_exchange_allowed c1 c2))) (ensures ( equiv_option_states (machine_eval_codes [c1; c2] fuel s) (machine_eval_codes [c2; c1] fuel s))) = lemma_bounded_code c1 fuel; lemma_bounded_code c2 fuel; let f1 = wrap_sos (machine_eval_code c1 fuel) in let f2 = wrap_sos (machine_eval_code c2 fuel) in lemma_commute f1 f2 (rw_set_of_code c1) (rw_set_of_code c2) s; assert (equiv_states_or_both_not_ok (run2 f1 f2 s) (run2 f2 f1 s)); let s1 = run f1 s in let s12 = run f2 s1 in let s2 = run f2 s in let s21 = run f1 s2 in allow_inversion (option machine_state); FStar.Classical.move_requires (lemma_not_ok_propagate_code c1 fuel) s; FStar.Classical.move_requires (lemma_not_ok_propagate_code c2 fuel) s1; FStar.Classical.move_requires (lemma_not_ok_propagate_code c2 fuel) s; FStar.Classical.move_requires (lemma_not_ok_propagate_code c1 fuel) s2; FStar.Classical.move_requires (lemma_not_ok_propagate_codes [c1;c2] fuel) s; FStar.Classical.move_requires (lemma_not_ok_propagate_codes [c2;c1] fuel) s #pop-options /// Given that we can perform simple swaps between [code]s, we can /// define a relation that tells us if some [codes] can be transformed /// into another using only allowed swaps. #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec bubble_to_top (cs:codes) (i:nat{i < L.length cs}) : possibly (cs':codes{ let a, b, c = L.split3 cs i in cs' == L.append a c /\ L.length cs' = L.length cs - 1 }) = match cs with | [_] -> return [] | h :: t -> if i = 0 then ( return t ) else ( let x = L.index cs i in if not (safely_bounded_code_p x) then ( Err ("Cannot safely move " ^ fst (print_code x 0 gcc)) ) else ( if not (safely_bounded_code_p h) then ( Err ("Cannot safely move beyond " ^ fst (print_code h 0 gcc)) ) else ( match bubble_to_top t (i - 1) with | Err reason -> Err reason | Ok res -> match code_exchange_allowed x h with | Err reason -> Err reason | Ok () -> return (h :: res) ) ) ) #pop-options let rec num_blocks_in_codes (c:codes) : nat = match c with | [] -> 0 | Block l :: t -> 1 + num_blocks_in_codes l + num_blocks_in_codes t | _ :: t -> num_blocks_in_codes t let rec lemma_num_blocks_in_codes_append (c1 c2:codes) : Lemma (ensures (num_blocks_in_codes (c1 `L.append` c2) == num_blocks_in_codes c1 + num_blocks_in_codes c2)) [SMTPat (num_blocks_in_codes (c1 `L.append` c2))] = match c1 with | [] -> () | x :: xs -> lemma_num_blocks_in_codes_append xs c2 type transformation_hint = | MoveUpFrom : p:nat -> transformation_hint | DiveInAt : p:nat -> q:transformation_hint -> transformation_hint | InPlaceIfElse : ifTrue:transformation_hints -> ifFalse:transformation_hints -> transformation_hint | InPlaceWhile : whileBody:transformation_hints -> transformation_hint and transformation_hints = list transformation_hint let rec string_of_transformation_hint (th:transformation_hint) : Tot string (decreases %[th]) = match th with | MoveUpFrom p -> "(MoveUpFrom " ^ string_of_int p ^ ")" | DiveInAt p q -> "(DiveInAt " ^ string_of_int p ^ " " ^ string_of_transformation_hint q ^ ")" | InPlaceIfElse tr fa -> "(InPlaceIfElse " ^ string_of_transformation_hints tr ^ " " ^ string_of_transformation_hints fa ^ ")" | InPlaceWhile bo -> "(InPlaceWhile " ^ string_of_transformation_hints bo ^ ")" and aux_string_of_transformation_hints (ts:transformation_hints) : Tot string (decreases %[ts; 0]) = match ts with | [] -> "" | x :: xs -> string_of_transformation_hint x ^ "; " ^ aux_string_of_transformation_hints xs and string_of_transformation_hints (ts:transformation_hints) : Tot string (decreases %[ts; 1]) = "[" ^ aux_string_of_transformation_hints ts ^ "]" let rec wrap_diveinat (p:nat) (l:transformation_hints) : transformation_hints = match l with | [] -> [] | x :: xs -> DiveInAt p x :: wrap_diveinat p xs (* XXX: Copied from List.Tot.Base because of an extraction issue. See https://github.com/FStarLang/FStar/pull/1822. *) val split3: #a:Type -> l:list a -> i:nat{i < L.length l} -> Tot (list a * a * list a) let split3 #a l i = let a, as0 = L.splitAt i l in L.lemma_splitAt_snd_length i l; let b :: c = as0 in a, b, c let rec is_empty_code (c:code) : bool = match c with | Ins _ -> false | Block l -> is_empty_codes l | IfElse _ t f -> false | While _ c -> false and is_empty_codes (c:codes) : bool = match c with | [] -> true | x :: xs -> is_empty_code x && is_empty_codes xs let rec perform_reordering_with_hint (t:transformation_hint) (c:codes) : possibly codes = match c with | [] -> Err "trying to transform empty code" | x :: xs -> if is_empty_codes [x] then perform_reordering_with_hint t xs else ( match t with | MoveUpFrom i -> ( if i < L.length c then ( let+ c'= bubble_to_top c i in return (L.index c i :: c') ) else ( Err ("invalid hint : " ^ string_of_transformation_hint t) ) ) | DiveInAt i t' -> if i < L.length c then ( FStar.List.Pure.lemma_split3_length c i; let left, mid, right = split3 c i in match mid with | Block l -> let+ l' = perform_reordering_with_hint t' l in ( match l' with | [] -> Err "impossible" | y :: ys -> L.append_length left [y]; let+ left' = bubble_to_top (left `L.append` [y]) i in return (y :: (left' `L.append` (Block ys :: right))) ) | _ -> Err ("trying to dive into a non-block : " ^ string_of_transformation_hint t ^ " " ^ fst (print_code (Block c) 0 gcc)) ) else ( Err ("invalid hint : " ^ string_of_transformation_hint t) ) | InPlaceIfElse tht thf -> ( match x with | IfElse c (Block t) (Block f) -> let+ tt = perform_reordering_with_hints tht t in let+ ff = perform_reordering_with_hints thf f in return (IfElse c (Block tt) (Block ff) :: xs) | _ -> Err ("Invalid hint : " ^ string_of_transformation_hint t ^ " for codes " ^ fst (print_code (Block c) 0 gcc)) ) | InPlaceWhile thb -> ( match x with | While c (Block b) -> let+ bb = perform_reordering_with_hints thb b in return (While c (Block bb) :: xs) | _ -> Err ("Invalid hint : " ^ string_of_transformation_hint t ^ " for codes " ^ fst (print_code (Block c) 0 gcc)) ) ) and perform_reordering_with_hints (ts:transformation_hints) (c:codes) : possibly codes = (* let _ = IO.debug_print_string ( "-----------------------------\n" ^ " th : " ^ string_of_transformation_hints ts ^ "\n" ^ " c :\n" ^ fst (print_code (Block c) 0 gcc) ^ "\n" ^ "-----------------------------\n" ^ "") in *) match ts with | [] -> ( if is_empty_codes c then ( return [] ) else ( (* let _ = IO.debug_print_string ( "failed here!!!\n" ^ "\n") in *) Err ("no more transformation hints for " ^ fst (print_code (Block c) 0 gcc)) ) ) | t :: ts' -> let+ c' = perform_reordering_with_hint t c in match c' with | [] -> Err "impossible" | x :: xs -> if is_empty_codes [x] then ( Err "Trying to move 'empty' code." ) else ( (* let _ = IO.debug_print_string ( "dragged up: \n" ^ fst (print_code x 0 gcc) ^ "\n") in *) let+ xs' = perform_reordering_with_hints ts' xs in return (x :: xs') ) (* NOTE: We assume this function since it is not yet exposed. Once exposed from the instructions module, we should be able to remove it from here. Also, note that we don't require any other properties from [eq_ins]. It is an uninterpreted function that simply gives us a "hint" to find equivalent instructions! For testing purposes, we have it set to an [irreducible] function that looks at the printed representation of the instructions. Since it is irreducible, no other function should be able to "look into" the definition of this function, but instead should be limited only to its signature. However, the OCaml extraction _should_ be able to peek inside, and be able to proceed. *) irreducible let eq_ins (i1 i2:ins) : bool = print_ins i1 gcc = print_ins i2 gcc let rec eq_code (c1 c2:code) : bool = match c1, c2 with | Ins i1, Ins i2 -> eq_ins i1 i2 | Block l1, Block l2 -> eq_codes l1 l2 | IfElse c1 t1 f1, IfElse c2 t2 f2 -> c1 = c2 && eq_code t1 t2 && eq_code f1 f2 | While c1 b1, While c2 b2 -> c1 = c2 && eq_code b1 b2 | _, _ -> false and eq_codes (c1 c2:codes) : bool = match c1, c2 with | [], [] -> true | _, [] | [], _ -> false | x :: xs, y :: ys -> eq_code x y && eq_codes xs ys let rec fully_unblocked_code (c:code) : codes = match c with | Ins i -> [c] | Block l -> fully_unblocked_codes l | IfElse c t f -> [IfElse c (Block (fully_unblocked_code t)) (Block (fully_unblocked_code f))] | While c b -> [While c (Block (fully_unblocked_code b))] and fully_unblocked_codes (c:codes) : codes = match c with | [] -> [] | x :: xs -> fully_unblocked_code x `L.append` fully_unblocked_codes xs let increment_hint (th:transformation_hint) : transformation_hint = match th with | MoveUpFrom p -> MoveUpFrom (p + 1) | DiveInAt p q -> DiveInAt (p + 1) q | _ -> th let rec find_deep_code_transform (c:code) (cs:codes) : possibly transformation_hint = match cs with | [] -> Err ("Not found (during find_deep_code_transform): " ^ fst (print_code c 0 gcc)) | x :: xs -> (* let _ = IO.debug_print_string ( "---------------------------------\n" ^ " c : \n" ^ fst (print_code c 0 gcc) ^ "\n" ^ " x : \n" ^ fst (print_code x 0 gcc) ^ "\n" ^ " xs : \n" ^ fst (print_code (Block xs) 0 gcc) ^ "\n" ^ "---------------------------------\n" ^ "") in *) if is_empty_code x then find_deep_code_transform c xs else ( if eq_codes (fully_unblocked_code x) (fully_unblocked_code c) then ( return (MoveUpFrom 0) ) else ( match x with | Block l -> ( match find_deep_code_transform c l with | Ok t -> return (DiveInAt 0 t) | Err reason -> let+ th = find_deep_code_transform c xs in return (increment_hint th) ) | _ -> let+ th = find_deep_code_transform c xs in return (increment_hint th) ) ) let rec metric_for_code (c:code) : GTot nat = 1 + ( match c with | Ins _ -> 0 | Block l -> metric_for_codes l | IfElse _ t f -> metric_for_code t + metric_for_code f | While _ b -> metric_for_code b ) and metric_for_codes (c:codes) : GTot nat = match c with | [] -> 0 | x :: xs -> 1 + metric_for_code x + metric_for_codes xs let rec lemma_metric_for_codes_append (c1 c2:codes) : Lemma (ensures (metric_for_codes (c1 `L.append` c2) == metric_for_codes c1 + metric_for_codes c2)) [SMTPat (metric_for_codes (c1 `L.append` c2))] = match c1 with | [] -> () | x :: xs -> lemma_metric_for_codes_append xs c2 irreducible (* Our proofs do not depend on how the hints are found. As long as some hints are provided, we validate the hints to perform the transformation and use it. Thus, we make this function [irreducible] to explicitly prevent any of the proofs from reasoning about it. *) let rec find_transformation_hints (c1 c2:codes) : Tot (possibly transformation_hints) (decreases %[metric_for_codes c2; metric_for_codes c1]) = let e1, e2 = is_empty_codes c1, is_empty_codes c2 in if e1 && e2 then ( return [] ) else if e2 then ( Err ("non empty first code: " ^ fst (print_code (Block c1) 0 gcc)) ) else if e1 then ( Err ("non empty second code: " ^ fst (print_code (Block c2) 0 gcc)) ) else ( let h1 :: t1 = c1 in let h2 :: t2 = c2 in assert (metric_for_codes c2 >= metric_for_code h2); (* OBSERVE *) if is_empty_code h1 then ( find_transformation_hints t1 c2 ) else if is_empty_code h2 then ( find_transformation_hints c1 t2 ) else ( match find_deep_code_transform h2 c1 with | Ok th -> ( match perform_reordering_with_hint th c1 with | Ok (h1 :: t1) -> let+ t_hints2 = find_transformation_hints t1 t2 in return (th :: t_hints2) | Ok [] -> Err "Impossible" | Err reason -> Err ("Unable to find valid movement for : " ^ fst (print_code h2 0 gcc) ^ ". Reason: " ^ reason) ) | Err reason -> ( let h1 :: t1 = c1 in match h1, h2 with | Block l1, Block l2 -> ( match ( let+ t_hints1 = find_transformation_hints l1 l2 in let+ t_hints2 = find_transformation_hints t1 t2 in return (wrap_diveinat 0 t_hints1 `L.append` t_hints2) ) with | Ok ths -> return ths | Err reason -> find_transformation_hints c1 (l2 `L.append` t2) ) | IfElse co1 (Block tr1) (Block fa1), IfElse co2 (Block tr2) (Block fa2) -> (co1 = co2) /- ("Non-same conditions for IfElse: (" ^ print_cmp co1 0 gcc ^ ") and (" ^ print_cmp co2 0 gcc ^ ")");+ assert (metric_for_code h2 > metric_for_code (Block tr2)); (* OBSERVE *) assert (metric_for_code h2 > metric_for_code (Block fa2)); (* OBSERVE *) let+ tr_hints = find_transformation_hints tr1 tr2 in let+ fa_hints = find_transformation_hints fa1 fa2 in let+ t_hints2 = find_transformation_hints t1 t2 in return (InPlaceIfElse tr_hints fa_hints :: t_hints2) | While co1 (Block bo1), While co2 (Block bo2) -> (co1 = co2) /- ("Non-same conditions for While: (" ^ print_cmp co1 0 gcc ^ ") and (" ^ print_cmp co2 0 gcc ^ ")");+ assert (metric_for_code h2 > metric_for_code (Block bo2)); (* OBSERVE *) let+ bo_hints = find_transformation_hints bo1 bo2 in let+ t_hints2 = find_transformation_hints t1 t2 in return (InPlaceWhile bo_hints :: t_hints2) | Block l1, IfElse _ _ _ | Block l1, While _ _ -> assert (metric_for_codes (l1 `L.append` t1) == metric_for_codes l1 + metric_for_codes t1); (* OBSERVE *) assert_norm (metric_for_codes c1 == 2 + metric_for_codes l1 + metric_for_codes t1); (* OBSERVE *) let+ t_hints1 = find_transformation_hints (l1 `L.append` t1) c2 in ( match t_hints1 with | [] -> Err "Impossible" | th :: _ -> let th = DiveInAt 0 th in match perform_reordering_with_hint th c1 with | Ok (h1 :: t1) -> let+ t_hints2 = find_transformation_hints t1 t2 in return (th :: t_hints2) | Ok [] -> Err "Impossible" | Err reason -> Err ("Failed during left-unblock for " ^ fst (print_code h2 0 gcc) ^ ". Reason: " ^ reason) ) | _, Block l2 -> find_transformation_hints c1 (l2 `L.append` t2) | IfElse _ _ _, IfElse _ _ _ | While _ _, While _ _ -> Err ("Found weird non-standard code: " ^ fst (print_code h1 0 gcc)) | _ -> Err ("Find deep code failure. Reason: " ^ reason) ) ) ) /// If a transformation can be performed, then the result behaves /// identically as per the [equiv_states] relation. #push-options "--z3rlimit 10 --initial_fuel 3 --max_fuel 3 --initial_ifuel 1 --max_ifuel 1" let rec lemma_bubble_to_top (cs : codes) (i:nat{i < L.length cs}) (fuel:nat) (s s' : machine_state) : Lemma (requires ( (s'.ms_ok) /\ (Some s' == machine_eval_codes cs fuel s) /\ (Ok? (bubble_to_top cs i)))) (ensures ( let x = L.index cs i in let Ok xs = bubble_to_top cs i in let s1' = machine_eval_code x fuel s in (Some? s1') /\ ( let Some s1 = s1' in let s2' = machine_eval_codes xs fuel s1 in (Some? s2') /\ ( let Some s2 = s2' in equiv_states s' s2)))) = match cs with | [_] -> () | h :: t -> let x = L.index cs i in let Ok xs = bubble_to_top cs i in if i = 0 then () else ( let Some s_h = machine_eval_code h fuel s in lemma_bubble_to_top (L.tl cs) (i-1) fuel s_h s'; let Some s_h_x = machine_eval_code x fuel s_h in let Some s_hx = machine_eval_codes [h;x] fuel s in assert (s_h_x == s_hx); lemma_code_exchange_allowed x h fuel s; FStar.Classical.move_requires (lemma_not_ok_propagate_codes (L.tl xs) fuel) s_hx; assert (s_hx.ms_ok); let Some s_xh = machine_eval_codes [x;h] fuel s in lemma_eval_codes_equiv_states (L.tl xs) fuel s_hx s_xh ) #pop-options #push-options "--initial_fuel 3 --max_fuel 3 --initial_ifuel 1 --max_ifuel 1" let rec lemma_machine_eval_codes_block_to_append (c1 c2 : codes) (fuel:nat) (s:machine_state) : Lemma (ensures (machine_eval_codes (c1 `L.append` c2) fuel s == machine_eval_codes (Block c1 :: c2) fuel s)) = match c1 with | [] -> () | x :: xs -> match machine_eval_code x fuel s with | None -> () | Some s1 -> lemma_machine_eval_codes_block_to_append xs c2 fuel s1 #pop-options let rec lemma_append_single (xs:list 'a) (y:'a) (i:nat) : Lemma (requires (i == L.length xs)) (ensures ( L.length (xs `L.append` [y]) = L.length xs + 1 /\ L.index (xs `L.append` [y]) i == y)) = match xs with | [] -> () | x :: xs -> lemma_append_single xs y (i - 1) #push-options "--initial_fuel 3 --max_fuel 3 --initial_ifuel 1 --max_ifuel 1" let rec lemma_is_empty_code (c:code) (fuel:nat) (s:machine_state) : Lemma (requires (is_empty_code c)) (ensures ((machine_eval_code c fuel s) == (machine_eval_codes [] fuel s))) = match c with | Ins _ -> () | Block l -> lemma_is_empty_codes l fuel s | IfElse _ t f -> () | While _ c -> () and lemma_is_empty_codes (cs:codes) (fuel:nat) (s:machine_state) : Lemma (requires (is_empty_codes cs)) (ensures ((machine_eval_codes cs fuel s) == (machine_eval_codes [] fuel s))) = match cs with | [] -> () | x :: xs -> lemma_is_empty_code x fuel s; lemma_is_empty_codes xs fuel s #pop-options #restart-solver
{ "checked_file": "/", "dependencies": [ "Vale.X64.Print_s.fst.checked", "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instructions_s.fsti.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.Bytes_Code_s.fst.checked", "Vale.Transformers.Locations.fsti.checked", "Vale.Transformers.BoundedInstructionEffects.fsti.checked", "Vale.Def.PossiblyMonad.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Option.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.List.Pure.fst.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Vale.Transformers.InstructionReorder.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Vale.Transformers.BoundedInstructionEffects", "short_module": null }, { "abbrev": false, "full_module": "Vale.Transformers.Locations", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.PossiblyMonad", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Print_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Bytes_Code_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Transformers", "short_module": null }, { "abbrev": false, "full_module": "Vale.Transformers", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 3, "initial_ifuel": 1, "max_fuel": 3, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Vale.Transformers.InstructionReorder.transformation_hint -> cs: Vale.X64.Machine_Semantics_s.codes -> fuel: Prims.nat -> s: Vale.X64.Machine_Semantics_s.machine_state -> FStar.Pervasives.Lemma (requires Ok? (Vale.Transformers.InstructionReorder.perform_reordering_with_hint t cs) /\ Some? (Vale.X64.Machine_Semantics_s.machine_eval_codes cs fuel s) /\ Mkmachine_state?.ms_ok (Some?.v (Vale.X64.Machine_Semantics_s.machine_eval_codes cs fuel s)) ) (ensures (let _ = Vale.Transformers.InstructionReorder.perform_reordering_with_hint t cs in (let Vale.Def.PossiblyMonad.Ok #_ cs' = _ in Vale.Transformers.InstructionReorder.equiv_ostates (Vale.X64.Machine_Semantics_s.machine_eval_codes cs fuel s) (Vale.X64.Machine_Semantics_s.machine_eval_codes cs' fuel s)) <: Type0)) (decreases %[t;fuel;cs])
FStar.Pervasives.Lemma
[ "lemma", "" ]
[ "lemma_perform_reordering_with_hint", "lemma_perform_reordering_with_hints" ]
[ "Vale.Transformers.InstructionReorder.transformation_hint", "Vale.X64.Machine_Semantics_s.codes", "Prims.nat", "Vale.X64.Machine_Semantics_s.machine_state", "Vale.X64.Bytes_Code_s.code_t", "Vale.X64.Machine_Semantics_s.instr_annotation", "Prims.list", "Vale.Transformers.InstructionReorder.is_empty_codes", "Prims.Cons", "Prims.Nil", "Vale.X64.Machine_Semantics_s.machine_eval_code", "Vale.Transformers.InstructionReorder.lemma_perform_reordering_with_hint", "Prims.unit", "Vale.Transformers.InstructionReorder.lemma_eval_codes_equiv_states", "Vale.Transformers.InstructionReorder.lemma_is_empty_codes", "Prims.bool", "FStar.List.Tot.Base.split3", "Prims.l_and", "Prims.eq2", "FStar.List.Tot.Base.append", "Prims.b2t", "Prims.op_Equality", "Prims.int", "FStar.List.Tot.Base.length", "Prims.op_Subtraction", "Vale.Transformers.InstructionReorder.lemma_bubble_to_top", "Vale.Def.PossiblyMonad.possibly", "Vale.Transformers.InstructionReorder.bubble_to_top", "Vale.X64.Machine_s.precode", "Vale.X64.Bytes_Code_s.instruction_t", "Vale.X64.Bytes_Code_s.ocmp", "Vale.Transformers.InstructionReorder.lemma_machine_eval_codes_block_to_append", "Vale.X64.Machine_s.Block", "Prims._assert", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.Some", "Vale.X64.Machine_Semantics_s.machine_eval_codes", "Vale.Transformers.InstructionReorder.equiv_states", "FStar.List.Tot.Base.index", "Vale.Transformers.InstructionReorder.lemma_append_single", "Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_ok", "Vale.Transformers.InstructionReorder.lemma_not_ok_propagate_codes", "FStar.List.Tot.Properties.append_l_cons", "FStar.List.Tot.Properties.append_length", "Vale.Transformers.InstructionReorder.perform_reordering_with_hint", "FStar.Pervasives.Native.tuple3", "FStar.List.Pure.Properties.lemma_split3_length", "FStar.List.Pure.Properties.lemma_split3_append", "Vale.X64.Machine_s.IfElse", "Vale.Transformers.InstructionReorder.lemma_perform_reordering_with_hints", "Prims.op_Negation", "FStar.Pervasives.Native.tuple2", "Vale.X64.Machine_Semantics_s.machine_eval_ocmp", "FStar.Pervasives.Native.Mktuple2", "Vale.Transformers.InstructionReorder.lemma_eval_code_equiv_states", "Vale.X64.Machine_s.While", "Prims.op_disEquality", "Vale.Def.PossiblyMonad.uu___is_Ok", "FStar.Pervasives.Native.uu___is_Some", "FStar.Pervasives.Native.__proj__Some__item__v", "Prims.squash", "Vale.Transformers.InstructionReorder.equiv_ostates", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec lemma_perform_reordering_with_hint (t: transformation_hint) (cs: codes) (fuel: nat) (s: machine_state) : Lemma (requires ((Ok? (perform_reordering_with_hint t cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures (let Ok cs' = perform_reordering_with_hint t cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[t;fuel;cs]) =
let c = cs in let Ok cs' = perform_reordering_with_hint t cs in let Some s' = machine_eval_codes cs fuel s in let x :: xs = cs in if is_empty_codes [x] then (lemma_is_empty_codes [x] fuel s; match machine_eval_code x fuel s with | None -> () | Some s' -> lemma_eval_codes_equiv_states xs fuel s s'; lemma_perform_reordering_with_hint t xs fuel s) else (match t with | MoveUpFrom i -> (let Ok c' = bubble_to_top c i in lemma_bubble_to_top c i fuel s s') | DiveInAt i t' -> (FStar.List.Pure.lemma_split3_append c i; FStar.List.Pure.lemma_split3_length c i; let left, mid, right = L.split3 c i in let Block l = mid in let Ok (y :: ys) = perform_reordering_with_hint t' l in L.append_length left [y]; let Ok left' = bubble_to_top (left `L.append` [y]) i in assert (cs' == y :: (left' `L.append` (Block ys :: right))); assert (left `L.append` (mid :: right) == c); L.append_l_cons mid right left; assert ((left `L.append` [mid]) `L.append` right == c); lemma_machine_eval_codes_block_to_append (left `L.append` [mid]) right fuel s; let Some s_1 = machine_eval_code (Block (left `L.append` [mid])) fuel s in assert (Some s_1 == machine_eval_codes (left `L.append` [mid]) fuel s); lemma_machine_eval_codes_block_to_append left [mid] fuel s; let Some s_2 = machine_eval_code (Block left) fuel s in assert (Some s_2 == machine_eval_codes left fuel s); assert (Some s_1 == machine_eval_codes [mid] fuel s_2); assert (Some s_1 == machine_eval_code (Block l) fuel s_2); assert (Some s_1 == machine_eval_codes l fuel s_2); assert (Some s' == machine_eval_codes right fuel s_1); if s_1.ms_ok then () else lemma_not_ok_propagate_codes right fuel s_1; lemma_perform_reordering_with_hint t' l fuel s_2; let Some s_11 = machine_eval_codes (y :: ys) fuel s_2 in let Some s_12 = machine_eval_code y fuel s_2 in if s_12.ms_ok then () else lemma_not_ok_propagate_codes ys fuel s_12; assert (Some s_2 == machine_eval_codes left fuel s); assert (Some s_2 == machine_eval_code (Block left) fuel s); assert (Some s_12 == machine_eval_codes ([Block left; y]) fuel s); lemma_machine_eval_codes_block_to_append left [y] fuel s; assert (Some s_12 == machine_eval_codes (left `L.append` [y]) fuel s); lemma_bubble_to_top (left `L.append` [y]) i fuel s s_12; lemma_append_single left y i; assert (L.index (left `L.append` [y]) i == y); let Some s_3 = machine_eval_codes (y :: left') fuel s in assert (equiv_states s_3 s_12); lemma_eval_codes_equiv_states right fuel s_1 s_11; let Some s_0 = machine_eval_codes right fuel s_11 in lemma_eval_codes_equiv_states (Block ys :: right) fuel s_12 s_3; let Some s_00 = machine_eval_codes (Block ys :: right) fuel s_3 in assert (equiv_states s_00 s'); assert (Some s_3 == machine_eval_code (Block (y :: left')) fuel s); assert (Some s_00 == machine_eval_codes (Block ys :: right) fuel s_3); lemma_machine_eval_codes_block_to_append (y :: left') (Block ys :: right) fuel s) | InPlaceIfElse tht thf -> (let IfElse cond c_ift c_iff :: xs = cs in let Block cs_ift, Block cs_iff = c_ift, c_iff in let s1, b = machine_eval_ocmp s cond in if b then (assert (Some s' == machine_eval_codes (c_ift :: xs) fuel s1); let Some s'' = machine_eval_code c_ift fuel s1 in if not s''.ms_ok then (lemma_not_ok_propagate_codes xs fuel s''); lemma_perform_reordering_with_hints tht cs_ift fuel s1; let Some s''' = machine_eval_code (IfElse cond c_ift c_iff) fuel s in let x' :: _ = cs' in let Some s'''' = machine_eval_code x' fuel s in assert (equiv_states s''' s''''); lemma_eval_codes_equiv_states xs fuel s''' s'''') else (let Some s'' = machine_eval_code c_iff fuel s1 in if not s''.ms_ok then (lemma_not_ok_propagate_codes xs fuel s''); lemma_perform_reordering_with_hints thf cs_iff fuel s1; let Some s''' = machine_eval_code (IfElse cond c_ift c_iff) fuel s in let x' :: _ = cs' in let Some s'''' = machine_eval_code x' fuel s in lemma_eval_codes_equiv_states xs fuel s''' s'''')) | InPlaceWhile thb -> (assert (fuel <> 0); let While cond body :: xs = cs in let Block cs_body = body in let s0, b = machine_eval_ocmp s cond in if not b then () else (let Some s1 = machine_eval_code body (fuel - 1) s0 in if s1.ms_ok then () else lemma_not_ok_propagate_codes xs fuel s1; lemma_perform_reordering_with_hints thb cs_body (fuel - 1) s0; let x' :: xs' = cs' in assert (xs' == xs); let While cond' body' = x' in let cs_body' = body' in let Some s11 = machine_eval_code (While cond body) (fuel - 1) s1 in if s11.ms_ok then () else lemma_not_ok_propagate_codes xs fuel s11; assert (Some s' == machine_eval_codes xs fuel s11); lemma_perform_reordering_with_hint t [While cond body] (fuel - 1) s1; let Some s11' = machine_eval_code x' (fuel - 1) s1 in lemma_eval_codes_equiv_states xs fuel s11 s11'; let Some s'' = machine_eval_codes xs fuel s11' in assert (machine_eval_codes cs fuel s == Some s'); assert (equiv_states s' s''); let Some s1' = machine_eval_code body' (fuel - 1) s0 in lemma_eval_code_equiv_states x' (fuel - 1) s1 s1'; let Some s11'' = machine_eval_code x' (fuel - 1) s1' in assert (machine_eval_codes cs' fuel s == machine_eval_codes xs fuel s11''); lemma_eval_codes_equiv_states xs fuel s11' s11'')))
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_disjoint_loc_aux_includes
val loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3))
val loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3))
let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 53, "end_line": 148, "start_col": 0, "start_line": 141 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l1: FStar.Modifies.loc_aux -> l2: FStar.Modifies.loc_aux -> l3: FStar.Modifies.loc_aux -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_aux_disjoint l1 l2 /\ FStar.Modifies.loc_aux_includes l2 l3) (ensures FStar.Modifies.loc_aux_disjoint l1 l3)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Buffer.buffer", "FStar.Modifies.loc_aux_disjoint_loc_aux_includes_buffer", "Prims.unit", "Prims.l_and", "FStar.Modifies.loc_aux_disjoint", "FStar.Modifies.loc_aux_includes", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) =
match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3
false
FStar.Modifies.fst
FStar.Modifies.loc_aux_preserved
val loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0
val loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0
let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b )
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 5, "end_line": 158, "start_col": 0, "start_line": 150 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: FStar.Modifies.loc_aux -> h1: FStar.Monotonic.HyperStack.mem -> h2: FStar.Monotonic.HyperStack.mem -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Modifies.loc_aux", "FStar.Monotonic.HyperStack.mem", "FStar.Buffer.buffer", "Prims.l_imp", "FStar.Buffer.live", "Prims.l_and", "Prims.eq2", "FStar.Seq.Base.seq", "Prims.l_or", "Prims.nat", "FStar.Seq.Base.length", "FStar.Buffer.length", "FStar.Buffer.as_seq" ]
[]
false
false
false
false
true
let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 =
match l with | LocBuffer b -> (B.live h1 b) ==> (B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b)
false
FStar.Modifies.fst
FStar.Modifies.loc_regions
val loc_regions (preserve_liveness: bool) (r: Set.set HS.rid) : GTot loc
val loc_regions (preserve_liveness: bool) (r: Set.set HS.rid) : GTot loc
let loc_regions = MG.loc_regions
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 32, "end_line": 204, "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 FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness: Prims.bool -> r: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> Prims.GTot FStar.Modifies.loc
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.ModifiesGen.loc_regions", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
false
false
let loc_regions =
MG.loc_regions
false
FStar.Modifies.fst
FStar.Modifies.loc_includes
val loc_includes (s1 s2: loc) : GTot Type0
val loc_includes (s1 s2: loc) : GTot Type0
let loc_includes = MG.loc_includes
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 34, "end_line": 206, "start_col": 0, "start_line": 206 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.ModifiesGen.loc_includes", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
false
true
let loc_includes =
MG.loc_includes
false
FStar.Modifies.fst
FStar.Modifies.cls
val cls:MG.cls aloc
val cls:MG.cls aloc
let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () )
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 181, "start_col": 0, "start_line": 162 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.ModifiesGen.cls FStar.Modifies.aloc
Prims.Tot
[ "total" ]
[]
[ "FStar.ModifiesGen.Cls", "FStar.Modifies.aloc", "FStar.Monotonic.HyperHeap.rid", "Prims.nat", "FStar.Modifies.loc_aux_includes", "Prims.unit", "FStar.Modifies.loc_aux_disjoint", "FStar.Modifies.loc_aux_preserved", "FStar.Monotonic.HyperStack.mem", "FStar.Preorder.preorder", "FStar.Monotonic.HyperStack.mreference", "Prims.l_and", "FStar.Monotonic.HyperStack.contains", "Prims.eq2", "FStar.Monotonic.HyperStack.frameOf", "Prims.int", "Prims.l_or", "Prims.b2t", "Prims.op_GreaterThan", "Prims.op_GreaterThanOrEqual", "FStar.Monotonic.HyperStack.as_addr", "Prims.squash", "FStar.Monotonic.HyperStack.sel", "Prims.Nil", "FStar.Pervasives.pattern", "FStar.Buffer.buffer", "FStar.Classical.move_requires", "FStar.Buffer.live", "FStar.Buffer.lseq", "FStar.Buffer.max_length", "FStar.Heap.trivial_preorder", "FStar.Buffer.content" ]
[]
false
false
false
true
false
let cls:MG.cls aloc =
MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g ())
false
Vale.Transformers.InstructionReorder.fst
Vale.Transformers.InstructionReorder.lemma_perform_reordering_with_hints
val lemma_perform_reordering_with_hints (ts: transformation_hints) (cs: codes) (fuel: nat) (s: machine_state) : Lemma (requires ((Ok? (perform_reordering_with_hints ts cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures (let Ok cs' = perform_reordering_with_hints ts cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[ts;fuel;cs])
val lemma_perform_reordering_with_hints (ts: transformation_hints) (cs: codes) (fuel: nat) (s: machine_state) : Lemma (requires ((Ok? (perform_reordering_with_hints ts cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures (let Ok cs' = perform_reordering_with_hints ts cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[ts;fuel;cs])
let rec lemma_perform_reordering_with_hint (t:transformation_hint) (cs:codes) (fuel:nat) (s:machine_state) : Lemma (requires ( (Ok? (perform_reordering_with_hint t cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures ( let Ok cs' = perform_reordering_with_hint t cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[t; fuel; cs]) = let c = cs in let Ok cs' = perform_reordering_with_hint t cs in let Some s' = machine_eval_codes cs fuel s in let x :: xs = cs in if is_empty_codes [x] then ( lemma_is_empty_codes [x] fuel s; match machine_eval_code x fuel s with | None -> () | Some s' -> lemma_eval_codes_equiv_states xs fuel s s'; lemma_perform_reordering_with_hint t xs fuel s ) else ( match t with | MoveUpFrom i -> ( let Ok c' = bubble_to_top c i in lemma_bubble_to_top c i fuel s s' ) | DiveInAt i t' -> ( FStar.List.Pure.lemma_split3_append c i; FStar.List.Pure.lemma_split3_length c i; let left, mid, right = L.split3 c i in let Block l = mid in let Ok (y :: ys) = perform_reordering_with_hint t' l in L.append_length left [y]; let Ok left' = bubble_to_top (left `L.append` [y]) i in // assert (cs' == y :: (left' `L.append` (Block ys :: right))); assert (left `L.append` (mid :: right) == c); L.append_l_cons mid right left; assert ((left `L.append` [mid]) `L.append` right == c); lemma_machine_eval_codes_block_to_append (left `L.append` [mid]) right fuel s; let Some s_1 = machine_eval_code (Block (left `L.append` [mid])) fuel s in assert (Some s_1 == machine_eval_codes (left `L.append` [mid]) fuel s); lemma_machine_eval_codes_block_to_append left [mid] fuel s; let Some s_2 = machine_eval_code (Block left) fuel s in assert (Some s_2 == machine_eval_codes left fuel s); // assert (Some s_1 == machine_eval_codes [mid] fuel s_2); assert (Some s_1 == machine_eval_code (Block l) fuel s_2); assert (Some s_1 == machine_eval_codes l fuel s_2); assert (Some s' == machine_eval_codes right fuel s_1); if s_1.ms_ok then () else lemma_not_ok_propagate_codes right fuel s_1; lemma_perform_reordering_with_hint t' l fuel s_2; // let Some s_11 = machine_eval_codes (y :: ys) fuel s_2 in let Some s_12 = machine_eval_code y fuel s_2 in if s_12.ms_ok then () else lemma_not_ok_propagate_codes ys fuel s_12; assert (Some s_2 == machine_eval_codes left fuel s); assert (Some s_2 == machine_eval_code (Block left) fuel s); assert (Some s_12 == machine_eval_codes (Block left :: [y]) fuel s); lemma_machine_eval_codes_block_to_append left [y] fuel s; assert (Some s_12 == machine_eval_codes (left `L.append` [y]) fuel s); lemma_bubble_to_top (left `L.append` [y]) i fuel s s_12; // lemma_append_single left y i; assert (L.index (left `L.append` [y]) i == y); // let Some s_3 = machine_eval_codes (y :: left') fuel s in assert (equiv_states s_3 s_12); lemma_eval_codes_equiv_states right fuel s_1 s_11; let Some s_0 = machine_eval_codes right fuel s_11 in lemma_eval_codes_equiv_states (Block ys :: right) fuel s_12 s_3; let Some s_00 = machine_eval_codes (Block ys :: right) fuel s_3 in // assert (equiv_states s_00 s'); assert (Some s_3 == machine_eval_code (Block (y :: left')) fuel s); assert (Some s_00 == machine_eval_codes (Block ys :: right) fuel s_3); lemma_machine_eval_codes_block_to_append (y :: left') (Block ys :: right) fuel s ) | InPlaceIfElse tht thf -> ( let IfElse cond c_ift c_iff :: xs = cs in let Block cs_ift, Block cs_iff = c_ift, c_iff in let (s1, b) = machine_eval_ocmp s cond in if b then ( assert (Some s' == machine_eval_codes (c_ift :: xs) fuel s1); let Some s'' = machine_eval_code c_ift fuel s1 in if not s''.ms_ok then (lemma_not_ok_propagate_codes xs fuel s'') else (); lemma_perform_reordering_with_hints tht cs_ift fuel s1; let Some s''' = machine_eval_code (IfElse cond c_ift c_iff) fuel s in let x' :: _ = cs' in let Some s'''' = machine_eval_code x' fuel s in assert (equiv_states s''' s''''); lemma_eval_codes_equiv_states xs fuel s''' s'''' ) else ( let Some s'' = machine_eval_code c_iff fuel s1 in if not s''.ms_ok then (lemma_not_ok_propagate_codes xs fuel s'') else (); lemma_perform_reordering_with_hints thf cs_iff fuel s1; let Some s''' = machine_eval_code (IfElse cond c_ift c_iff) fuel s in let x' :: _ = cs' in let Some s'''' = machine_eval_code x' fuel s in lemma_eval_codes_equiv_states xs fuel s''' s'''' ) ) | InPlaceWhile thb -> ( assert (fuel <> 0); let While cond body :: xs = cs in let Block cs_body = body in let (s0, b) = machine_eval_ocmp s cond in if not b then () else ( let Some s1 = machine_eval_code body (fuel - 1) s0 in if s1.ms_ok then () else lemma_not_ok_propagate_codes xs fuel s1; lemma_perform_reordering_with_hints thb cs_body (fuel - 1) s0; let x' :: xs' = cs' in assert (xs' == xs); let While cond' body' = x' in let cs_body' = body' in let Some s11 = machine_eval_code (While cond body) (fuel - 1) s1 in if s11.ms_ok then () else lemma_not_ok_propagate_codes xs fuel s11; assert (Some s' == machine_eval_codes xs fuel s11); lemma_perform_reordering_with_hint t [While cond body] (fuel - 1) s1; let Some s11' = machine_eval_code x' (fuel - 1) s1 in lemma_eval_codes_equiv_states xs fuel s11 s11'; let Some s'' = machine_eval_codes xs fuel s11' in assert (machine_eval_codes cs fuel s == Some s'); assert (equiv_states s' s''); let Some s1' = machine_eval_code body' (fuel - 1) s0 in lemma_eval_code_equiv_states x' (fuel-1) s1 s1'; let Some s11'' = machine_eval_code x' (fuel-1) s1' in assert (machine_eval_codes cs' fuel s == machine_eval_codes xs fuel s11''); lemma_eval_codes_equiv_states xs fuel s11' s11'' ) ) ) and lemma_perform_reordering_with_hints (ts:transformation_hints) (cs:codes) (fuel:nat) (s:machine_state) : Lemma (requires ( (Ok? (perform_reordering_with_hints ts cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures ( let Ok cs' = perform_reordering_with_hints ts cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[ts; fuel; cs]) = let c = cs in let Ok cs' = perform_reordering_with_hints ts cs in let Some s' = machine_eval_codes cs fuel s in match ts with | [] -> lemma_is_empty_codes cs fuel s | t :: ts' -> let Ok (x :: xs) = perform_reordering_with_hint t c in lemma_perform_reordering_with_hint t c fuel s; let Ok xs' = perform_reordering_with_hints ts' xs in let Some s1 = machine_eval_code x fuel s in lemma_perform_reordering_with_hints ts' xs fuel s1
{ "file_name": "vale/code/lib/transformers/Vale.Transformers.InstructionReorder.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 2126, "start_col": 0, "start_line": 1968 }
(** This module defines a transformer that performs safe instruction reordering. Example: The following set of instructions can be reordered in any order without any observable change in behavior: mov rax, 10 mov rbx, 3 Usage: Actual vale-tool or user-facing code should probably use the even nicer interface provided by the [Vale.Transformers.Transform] module. To use this module, you need to generate a [transformation_hints] object (a nice default is provided in this module via [find_transformation_hints], but users of this module can write their own, without needing to change any proofs), that can then be applied to a [codes] object (say [c1]) via [perform_reordering_with_hints] which tells you if this is a safe reordering, and if so, it produces the transformed [codes] object. If it is not considered to be safe, then the transformer gives a (human-readable) reason for why it doesn't consider it a safe reordering. If the transformation is safe and was indeed performed, then you can use [lemma_perform_reordering_with_hints] to reason about the reordered code having semantically equivalent behavior as the untransformed code. *) module Vale.Transformers.InstructionReorder /// Open all the relevant modules open Vale.X64.Bytes_Code_s open Vale.X64.Instruction_s open Vale.X64.Instructions_s open Vale.X64.Machine_Semantics_s open Vale.X64.Machine_s open Vale.X64.Print_s open Vale.Def.PossiblyMonad open Vale.Transformers.Locations open Vale.Transformers.BoundedInstructionEffects module L = FStar.List.Tot /// Some convenience functions let rec locations_of_locations_with_values (lv:locations_with_values) : locations = match lv with | [] -> [] | (|l,v|) :: lv -> l :: locations_of_locations_with_values lv /// Given two read/write sets corresponding to two neighboring /// instructions, we can say whether exchanging those two instructions /// should be allowed. let write_same_constants (c1 c2:locations_with_values) : pbool = for_all (fun (x1:location_with_value) -> for_all (fun (x2:location_with_value) -> let (| l1, v1 |) = x1 in let (| l2, v2 |) = x2 in (if l1 = l2 then v1 = v2 else true) /- "not writing same constants" ) c2 ) c1 let aux_write_exchange_allowed (w2:locations) (c1 c2:locations_with_values) (x:location) : pbool = let cv1, cv2 = locations_of_locations_with_values c1, locations_of_locations_with_values c2 in (disjoint_location_from_locations x w2) ||. ((x `L.mem` cv1 && x `L.mem` cv2) /- "non constant write") let write_exchange_allowed (w1 w2:locations) (c1 c2:locations_with_values) : pbool = write_same_constants c1 c2 &&. for_all (aux_write_exchange_allowed w2 c1 c2) w1 &&. (* REVIEW: Just to make the symmetry proof easier, we write the other way around too. However, this makes things not as fast as they _could_ be. *) for_all (aux_write_exchange_allowed w1 c2 c1) w2 let rw_exchange_allowed (rw1 rw2 : rw_set) : pbool = let r1, w1, c1 = rw1.loc_reads, rw1.loc_writes, rw1.loc_constant_writes in let r2, w2, c2 = rw2.loc_reads, rw2.loc_writes, rw2.loc_constant_writes in (disjoint_locations r1 w2 /+< "read set of 1st not disjoint from write set of 2nd because ") &&. (disjoint_locations r2 w1 /+< "read set of 2nd not disjoint from write set of 1st because ") &&. (write_exchange_allowed w1 w2 c1 c2 /+< "write sets not disjoint because ") let ins_exchange_allowed (i1 i2 : ins) : pbool = ( match i1, i2 with | Instr _ _ _, Instr _ _ _ -> (rw_exchange_allowed (rw_set_of_ins i1) (rw_set_of_ins i2)) | _, _ -> ffalse "non-generic instructions: conservatively disallowed exchange" ) /+> normal (" for instructions " ^ print_ins i1 gcc ^ " and " ^ print_ins i2 gcc) let rec lemma_write_same_constants_symmetric (c1 c2:locations_with_values) : Lemma (ensures (!!(write_same_constants c1 c2) = !!(write_same_constants c2 c1))) = match c1, c2 with | [], [] -> () | x :: xs, [] -> lemma_write_same_constants_symmetric xs [] | [], y :: ys -> lemma_write_same_constants_symmetric [] ys | x :: xs, y :: ys -> lemma_write_same_constants_symmetric c1 ys; lemma_write_same_constants_symmetric xs c2; lemma_write_same_constants_symmetric xs ys let lemma_write_exchange_allowed_symmetric (w1 w2:locations) (c1 c2:locations_with_values) : Lemma (ensures (!!(write_exchange_allowed w1 w2 c1 c2) = !!(write_exchange_allowed w2 w1 c2 c1))) = lemma_write_same_constants_symmetric c1 c2 let lemma_ins_exchange_allowed_symmetric (i1 i2 : ins) : Lemma (requires ( !!(ins_exchange_allowed i1 i2))) (ensures ( !!(ins_exchange_allowed i2 i1))) = let rw1, rw2 = rw_set_of_ins i1, rw_set_of_ins i2 in let r1, w1, c1 = rw1.loc_reads, rw1.loc_writes, rw1.loc_constant_writes in let r2, w2, c2 = rw2.loc_reads, rw2.loc_writes, rw2.loc_constant_writes in lemma_write_exchange_allowed_symmetric w1 w2 c1 c2 /// First, we must define what it means for two states to be /// equivalent. Here, we basically say they must be exactly the same. let equiv_states (s1 s2 : machine_state) : GTot Type0 = (s1.ms_ok == s2.ms_ok) /\ (s1.ms_regs == s2.ms_regs) /\ (cf s1.ms_flags = cf s2.ms_flags) /\ (overflow s1.ms_flags = overflow s2.ms_flags) /\ (s1.ms_heap == s2.ms_heap) /\ (s1.ms_stack == s2.ms_stack) /\ (s1.ms_stackTaint == s2.ms_stackTaint) (** Same as [equiv_states] but uses extensionality to "think harder"; useful at lower-level details of the proof. *) let equiv_states_ext (s1 s2 : machine_state) : GTot Type0 = let open FStar.FunctionalExtensionality in (feq s1.ms_regs s2.ms_regs) /\ (s1.ms_heap == s2.ms_heap) /\ (Map.equal s1.ms_stack.stack_mem s2.ms_stack.stack_mem) /\ (Map.equal s1.ms_stackTaint s2.ms_stackTaint) /\ (equiv_states s1 s2) (** A weaker version of [equiv_states] that makes all non-ok states equivalent. Since non-ok states indicate something "gone-wrong" in execution, we can safely say that the rest of the state is irrelevant. *) let equiv_states_or_both_not_ok (s1 s2:machine_state) = (equiv_states s1 s2) \/ ((not s1.ms_ok) /\ (not s2.ms_ok)) (** Convenience wrapper around [equiv_states] *) unfold let equiv_ostates (s1 s2 : option machine_state) : GTot Type0 = (Some? s1 = Some? s2) /\ (Some? s1 ==> (equiv_states (Some?.v s1) (Some?.v s2))) (** An [option state] is said to be erroring if it is either [None] or if it is [Some] but is not ok. *) unfold let erroring_option_state (s:option machine_state) = match s with | None -> true | Some s -> not (s.ms_ok) (** [equiv_option_states s1 s2] means that [s1] and [s2] are equivalent [option machine_state]s iff both have same erroring behavior and if they are non-erroring, they are [equiv_states]. *) unfold let equiv_option_states (s1 s2:option machine_state) = (erroring_option_state s1 == erroring_option_state s2) /\ (not (erroring_option_state s1) ==> equiv_states (Some?.v s1) (Some?.v s2)) /// If evaluation starts from a set of equivalent states, and the /// exact same thing is evaluated, then the final states are still /// equivalent. unfold let proof_run (s:machine_state) (f:st unit) : machine_state = let (), s1 = f s in { s1 with ms_ok = s1.ms_ok && s.ms_ok } let rec lemma_instr_apply_eval_args_equiv_states (outs:list instr_out) (args:list instr_operand) (f:instr_args_t outs args) (oprs:instr_operands_t_args args) (s1 s2:machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( (instr_apply_eval_args outs args f oprs s1) == (instr_apply_eval_args outs args f oprs s2))) = match args with | [] -> () | i :: args -> let (v, oprs) : option (instr_val_t i) & _ = match i with | IOpEx i -> let oprs = coerce oprs in (instr_eval_operand_explicit i (fst oprs) s1, snd oprs) | IOpIm i -> (instr_eval_operand_implicit i s1, coerce oprs) in let f:arrow (instr_val_t i) (instr_args_t outs args) = coerce f in match v with | None -> () | Some v -> lemma_instr_apply_eval_args_equiv_states outs args (f v) oprs s1 s2 #push-options "--z3rlimit 10" let rec lemma_instr_apply_eval_inouts_equiv_states (outs inouts:list instr_out) (args:list instr_operand) (f:instr_inouts_t outs inouts args) (oprs:instr_operands_t inouts args) (s1 s2:machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( (instr_apply_eval_inouts outs inouts args f oprs s1) == (instr_apply_eval_inouts outs inouts args f oprs s2))) = match inouts with | [] -> lemma_instr_apply_eval_args_equiv_states outs args f oprs s1 s2 | (Out, i) :: inouts -> let oprs = match i with | IOpEx i -> snd #(instr_operand_t i) (coerce oprs) | IOpIm i -> coerce oprs in lemma_instr_apply_eval_inouts_equiv_states outs inouts args (coerce f) oprs s1 s2 | (InOut, i)::inouts -> let (v, oprs) : option (instr_val_t i) & _ = match i with | IOpEx i -> let oprs = coerce oprs in (instr_eval_operand_explicit i (fst oprs) s1, snd oprs) | IOpIm i -> (instr_eval_operand_implicit i s1, coerce oprs) in let f:arrow (instr_val_t i) (instr_inouts_t outs inouts args) = coerce f in match v with | None -> () | Some v -> lemma_instr_apply_eval_inouts_equiv_states outs inouts args (f v) oprs s1 s2 #pop-options #push-options "--z3rlimit 10 --max_fuel 1 --max_ifuel 0" let lemma_instr_write_output_implicit_equiv_states (i:instr_operand_implicit) (v:instr_val_t (IOpIm i)) (s_orig1 s1 s_orig2 s2:machine_state) : Lemma (requires ( (equiv_states s_orig1 s_orig2) /\ (equiv_states s1 s2))) (ensures ( (equiv_states (instr_write_output_implicit i v s_orig1 s1) (instr_write_output_implicit i v s_orig2 s2)))) = let snew1, snew2 = (instr_write_output_implicit i v s_orig1 s1), (instr_write_output_implicit i v s_orig2 s2) in assert (equiv_states_ext snew1 snew2) (* OBSERVE *) let lemma_instr_write_output_explicit_equiv_states (i:instr_operand_explicit) (v:instr_val_t (IOpEx i)) (o:instr_operand_t i) (s_orig1 s1 s_orig2 s2:machine_state) : Lemma (requires ( (equiv_states s_orig1 s_orig2) /\ (equiv_states s1 s2))) (ensures ( (equiv_states (instr_write_output_explicit i v o s_orig1 s1) (instr_write_output_explicit i v o s_orig2 s2)))) = let snew1, snew2 = (instr_write_output_explicit i v o s_orig1 s1), (instr_write_output_explicit i v o s_orig2 s2) in assert (equiv_states_ext snew1 snew2) (* OBSERVE *) #pop-options let rec lemma_instr_write_outputs_equiv_states (outs:list instr_out) (args:list instr_operand) (vs:instr_ret_t outs) (oprs:instr_operands_t outs args) (s_orig1 s1:machine_state) (s_orig2 s2:machine_state) : Lemma (requires ( (equiv_states s_orig1 s_orig2) /\ (equiv_states s1 s2))) (ensures ( (equiv_states (instr_write_outputs outs args vs oprs s_orig1 s1) (instr_write_outputs outs args vs oprs s_orig2 s2)))) = match outs with | [] -> () | (_, i)::outs -> ( let ((v:instr_val_t i), (vs:instr_ret_t outs)) = match outs with | [] -> (vs, ()) | _::_ -> let vs = coerce vs in (fst vs, snd vs) in match i with | IOpEx i -> let oprs = coerce oprs in lemma_instr_write_output_explicit_equiv_states i v (fst oprs) s_orig1 s1 s_orig2 s2; let s1 = instr_write_output_explicit i v (fst oprs) s_orig1 s1 in let s2 = instr_write_output_explicit i v (fst oprs) s_orig2 s2 in lemma_instr_write_outputs_equiv_states outs args vs (snd oprs) s_orig1 s1 s_orig2 s2 | IOpIm i -> lemma_instr_write_output_implicit_equiv_states i v s_orig1 s1 s_orig2 s2; let s1 = instr_write_output_implicit i v s_orig1 s1 in let s2 = instr_write_output_implicit i v s_orig2 s2 in lemma_instr_write_outputs_equiv_states outs args vs (coerce oprs) s_orig1 s1 s_orig2 s2 ) let lemma_eval_instr_equiv_states (it:instr_t_record) (oprs:instr_operands_t it.outs it.args) (ann:instr_annotation it) (s1 s2:machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( equiv_ostates (eval_instr it oprs ann s1) (eval_instr it oprs ann s2))) = let InstrTypeRecord #outs #args #havoc_flags' i = it in let vs1 = instr_apply_eval outs args (instr_eval i) oprs s1 in let vs2 = instr_apply_eval outs args (instr_eval i) oprs s2 in lemma_instr_apply_eval_inouts_equiv_states outs outs args (instr_eval i) oprs s1 s2; assert (vs1 == vs2); let s1_new = match havoc_flags' with | HavocFlags -> {s1 with ms_flags = havoc_flags} | PreserveFlags -> s1 in let s2_new = match havoc_flags' with | HavocFlags -> {s2 with ms_flags = havoc_flags} | PreserveFlags -> s2 in assert (overflow s1_new.ms_flags == overflow s2_new.ms_flags); assert (cf s1_new.ms_flags == cf s2_new.ms_flags); assert (equiv_states s1_new s2_new); let os1 = FStar.Option.mapTot (fun vs -> instr_write_outputs outs args vs oprs s1 s1_new) vs1 in let os2 = FStar.Option.mapTot (fun vs -> instr_write_outputs outs args vs oprs s2 s2_new) vs2 in match vs1 with | None -> () | Some vs -> lemma_instr_write_outputs_equiv_states outs args vs oprs s1 s1_new s2 s2_new #push-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 1" (* REVIEW: This proof is INSANELY annoying to deal with due to the [Pop]. TODO: Figure out why it is slowing down so much. It practically brings F* to a standstill even when editing, and it acts worse during an interactive proof. *) let lemma_machine_eval_ins_st_equiv_states (i : ins) (s1 s2 : machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( equiv_states (run (machine_eval_ins_st i) s1) (run (machine_eval_ins_st i) s2))) = let s1_orig, s2_orig = s1, s2 in let s1_final = run (machine_eval_ins_st i) s1 in let s2_final = run (machine_eval_ins_st i) s2 in match i with | Instr it oprs ann -> lemma_eval_instr_equiv_states it oprs ann s1 s2 | Push _ _ -> assert_spinoff (equiv_states_ext s1_final s2_final) | Pop dst t -> let stack_op = OStack (MReg (Reg 0 rRsp) 0, t) in let s1 = proof_run s1 (check (valid_src_operand64_and_taint stack_op)) in let s2 = proof_run s2 (check (valid_src_operand64_and_taint stack_op)) in // assert (equiv_states s1 s2); let new_dst1 = eval_operand stack_op s1 in let new_dst2 = eval_operand stack_op s2 in // assert (new_dst1 == new_dst2); let new_rsp1 = (eval_reg_64 rRsp s1 + 8) % pow2_64 in let new_rsp2 = (eval_reg_64 rRsp s2 + 8) % pow2_64 in // assert (new_rsp1 == new_rsp2); let s1 = proof_run s1 (update_operand64_preserve_flags dst new_dst1) in let s2 = proof_run s2 (update_operand64_preserve_flags dst new_dst2) in assert (equiv_states_ext s1 s2); let s1 = proof_run s1 (free_stack (new_rsp1 - 8) new_rsp1) in let s2 = proof_run s2 (free_stack (new_rsp2 - 8) new_rsp2) in // assert (equiv_states s1 s2); let s1 = proof_run s1 (update_rsp new_rsp1) in let s2 = proof_run s2 (update_rsp new_rsp2) in assert (equiv_states_ext s1 s2); assert_spinoff (equiv_states s1_final s2_final) | Alloc _ -> assert_spinoff (equiv_states_ext s1_final s2_final) | Dealloc _ -> assert_spinoff (equiv_states_ext s1_final s2_final) #pop-options let lemma_eval_ins_equiv_states (i : ins) (s1 s2 : machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( equiv_states (machine_eval_ins i s1) (machine_eval_ins i s2))) = lemma_machine_eval_ins_st_equiv_states i s1 s2 (** Filter out observation related stuff from the state. *) let filt_state (s:machine_state) = { s with ms_trace = [] } #push-options "--z3rlimit 10 --max_fuel 1 --max_ifuel 1" let rec lemma_eval_code_equiv_states (c : code) (fuel:nat) (s1 s2 : machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( let s1'', s2'' = machine_eval_code c fuel s1, machine_eval_code c fuel s2 in equiv_ostates s1'' s2'')) (decreases %[fuel; c]) = match c with | Ins ins -> reveal_opaque (`%machine_eval_code_ins) machine_eval_code_ins; lemma_eval_ins_equiv_states ins (filt_state s1) (filt_state s2) | Block l -> lemma_eval_codes_equiv_states l fuel s1 s2 | IfElse ifCond ifTrue ifFalse -> reveal_opaque (`%valid_ocmp_opaque) valid_ocmp_opaque; reveal_opaque (`%eval_ocmp_opaque) eval_ocmp_opaque; let (s1', b1) = machine_eval_ocmp s1 ifCond in let (s2', b2) = machine_eval_ocmp s2 ifCond in assert (b1 == b2); assert (equiv_states s1' s2'); if b1 then ( lemma_eval_code_equiv_states ifTrue fuel s1' s2' ) else ( lemma_eval_code_equiv_states ifFalse fuel s1' s2' ) | While cond body -> lemma_eval_while_equiv_states cond body fuel s1 s2 and lemma_eval_codes_equiv_states (cs : codes) (fuel:nat) (s1 s2 : machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( let s1'', s2'' = machine_eval_codes cs fuel s1, machine_eval_codes cs fuel s2 in equiv_ostates s1'' s2'')) (decreases %[fuel; cs]) = match cs with | [] -> () | c :: cs -> lemma_eval_code_equiv_states c fuel s1 s2; let s1'', s2'' = machine_eval_code c fuel s1, machine_eval_code c fuel s2 in match s1'' with | None -> () | _ -> let Some s1, Some s2 = s1'', s2'' in lemma_eval_codes_equiv_states cs fuel s1 s2 and lemma_eval_while_equiv_states (cond:ocmp) (body:code) (fuel:nat) (s1 s2:machine_state) : Lemma (requires (equiv_states s1 s2)) (ensures ( equiv_ostates (machine_eval_while cond body fuel s1) (machine_eval_while cond body fuel s2))) (decreases %[fuel; body]) = if fuel = 0 then () else ( reveal_opaque (`%valid_ocmp_opaque) valid_ocmp_opaque; reveal_opaque (`%eval_ocmp_opaque) eval_ocmp_opaque; let (s1, b1) = machine_eval_ocmp s1 cond in let (s2, b2) = machine_eval_ocmp s2 cond in assert (equiv_states s1 s2); assert (b1 == b2); if not b1 then () else ( assert (equiv_states s1 s2); let s_opt1 = machine_eval_code body (fuel - 1) s1 in let s_opt2 = machine_eval_code body (fuel - 1) s2 in lemma_eval_code_equiv_states body (fuel - 1) s1 s2; assert (equiv_ostates s_opt1 s_opt2); match s_opt1 with | None -> () | Some _ -> let Some s1, Some s2 = s_opt1, s_opt2 in if s1.ms_ok then ( lemma_eval_while_equiv_states cond body (fuel - 1) s1 s2 ) else () ) ) #pop-options /// If an exchange is allowed between two instructions based off of /// their read/write sets, then both orderings of the two instructions /// behave exactly the same, as per the previously defined /// [equiv_states] relation. /// /// Note that we require (for the overall proof) a notion of the /// following: /// /// s1 ===== s2 Key: /// | | /// . . + s1, s2, ... : machine_states /// . f1 . f2 + f1, f2 : some function from a /// . . machine_state to a /// | | machine_state /// V V + ===== : equiv_states /// s1' ===== s2' /// /// However, proving with the [equiv_states s1 s2] as part of the /// preconditions requires come complex wrangling and thinking about /// how different states [s1] and [s2] evolve. In particular, we'd /// need to show and write something similar _every_ step of the /// execution of [f1] and [f2]. Instead, we decompose the above /// diagram into the following: /// /// /// s1 ===== s2 /// / \ \ /// . . . /// . f1 . f2 . f2 /// . . . /// / \ \ /// V V V /// s1' ===== s2''===== s2' /// /// /// We now have the ability to decompose the left "triangular" portion /// which is similar to the rectangular diagram above, except the /// issue of having to manage both [s1] and [s2] is mitigated. Next, /// if we look at the right "parallelogram" portion of the diagram, we /// see that this is just the same as saying "running [f2] on /// [equiv_states] leads to [equiv_states]" which is something that is /// easier to prove. /// /// All the parallelogram proofs have already been completed by this /// point in the file, so only the triangular portions remain (and the /// one proof that links the two up into a single diagram as above). unfold let run2 (f1 f2:st unit) (s:machine_state) : machine_state = let open Vale.X64.Machine_Semantics_s in run (f1;* f2;* return ()) s let commutes (s:machine_state) (f1 f2:st unit) : GTot Type0 = equiv_states_or_both_not_ok (run2 f1 f2 s) (run2 f2 f1 s) let rec lemma_disjoint_implies_unchanged_at (reads changes:list location) (s1 s2:machine_state) : Lemma (requires (!!(disjoint_locations reads changes) /\ unchanged_except changes s1 s2)) (ensures (unchanged_at reads s1 s2)) = match reads with | [] -> () | x :: xs -> lemma_disjoint_implies_unchanged_at xs changes s1 s2 let rec lemma_disjoint_location_from_locations_append (a:location) (as1 as2:list location) : Lemma ( (!!(disjoint_location_from_locations a as1) /\ !!(disjoint_location_from_locations a as2)) <==> (!!(disjoint_location_from_locations a (as1 `L.append` as2)))) = match as1 with | [] -> () | x :: xs -> lemma_disjoint_location_from_locations_append a xs as2 let lemma_unchanged_except_transitive (a12 a23:list location) (s1 s2 s3:machine_state) : Lemma (requires (unchanged_except a12 s1 s2 /\ unchanged_except a23 s2 s3)) (ensures (unchanged_except (a12 `L.append` a23) s1 s3)) = let aux a : Lemma (requires (!!(disjoint_location_from_locations a (a12 `L.append` a23)))) (ensures (eval_location a s1 == eval_location a s3)) = lemma_disjoint_location_from_locations_append a a12 a23 in FStar.Classical.forall_intro (FStar.Classical.move_requires aux) let lemma_unchanged_except_append_symmetric (a1 a2:list location) (s1 s2:machine_state) : Lemma (requires (unchanged_except (a1 `L.append` a2) s1 s2)) (ensures (unchanged_except (a2 `L.append` a1) s1 s2)) = let aux a : Lemma (requires ( (!!(disjoint_location_from_locations a (a1 `L.append` a2))) \/ (!!(disjoint_location_from_locations a (a2 `L.append` a1))))) (ensures (eval_location a s1 == eval_location a s2)) = lemma_disjoint_location_from_locations_append a a1 a2; lemma_disjoint_location_from_locations_append a a2 a1 in FStar.Classical.forall_intro (FStar.Classical.move_requires aux) #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_disjoint_location_from_locations_mem (a1 a2:list location) (a:location) : Lemma (requires ( (L.mem a a1) /\ !!(disjoint_locations a1 a2))) (ensures ( !!(disjoint_location_from_locations a a2))) = match a1 with | [_] -> () | x :: xs -> if a = x then () else lemma_disjoint_location_from_locations_mem xs a2 a #pop-options #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_constant_on_execution_mem (locv:locations_with_values) (f:st unit) (s:machine_state) (l:location_eq) (v:location_val_eqt l) : Lemma (requires ( (constant_on_execution locv f s) /\ ((run f s).ms_ok) /\ ((| l, v |) `L.mem` locv))) (ensures ( (eval_location l (run f s) == raise_location_val_eqt v))) = match locv with | [_] -> () | x :: xs -> if x = (| l, v |) then () else ( lemma_constant_on_execution_mem xs f s l v ) #pop-options let rec lemma_disjoint_location_from_locations_mem1 (a:location) (as0:locations) : Lemma (requires (not (L.mem a as0))) (ensures (!!(disjoint_location_from_locations a as0))) = match as0 with | [] -> () | x :: xs -> lemma_disjoint_location_from_locations_mem1 a xs let rec value_of_const_loc (lv:locations_with_values) (l:location_eq{ L.mem l (locations_of_locations_with_values lv) }) : location_val_eqt l = let x :: xs = lv in if dfst x = l then dsnd x else value_of_const_loc xs l let rec lemma_write_same_constants_append (c1 c1' c2:locations_with_values) : Lemma (ensures ( !!(write_same_constants (c1 `L.append` c1') c2) = ( !!(write_same_constants c1 c2) && !!(write_same_constants c1' c2)))) = match c1 with | [] -> () | x :: xs -> lemma_write_same_constants_append xs c1' c2 let rec lemma_write_same_constants_mem_both (c1 c2:locations_with_values) (l:location_eq) : Lemma (requires (!!(write_same_constants c1 c2) /\ L.mem l (locations_of_locations_with_values c1) /\ L.mem l (locations_of_locations_with_values c2))) (ensures (value_of_const_loc c1 l = value_of_const_loc c2 l)) = let x :: xs = c1 in let y :: ys = c2 in if dfst x = l then ( if dfst y = l then () else ( lemma_write_same_constants_symmetric c1 c2; lemma_write_same_constants_symmetric ys c1; lemma_write_same_constants_mem_both c1 ys l ) ) else ( lemma_write_same_constants_mem_both xs c2 l ) let rec lemma_value_of_const_loc_mem (c:locations_with_values) (l:location_eq) (v:location_val_eqt l) : Lemma (requires ( L.mem l (locations_of_locations_with_values c) /\ value_of_const_loc c l = v)) (ensures (L.mem (|l,v|) c)) = let x :: xs = c in if dfst x = l then () else lemma_value_of_const_loc_mem xs l v #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_unchanged_at_mem (as0:list location) (a:location) (s1 s2:machine_state) : Lemma (requires ( (unchanged_at as0 s1 s2) /\ (L.mem a as0))) (ensures ( (eval_location a s1 == eval_location a s2))) = match as0 with | [_] -> () | x :: xs -> if a = x then () else lemma_unchanged_at_mem xs a s1 s2 #pop-options let lemma_unchanged_at_combine (a1 a2:locations) (c1 c2:locations_with_values) (sa1 sa2 sb1 sb2:machine_state) : Lemma (requires ( !!(write_exchange_allowed a1 a2 c1 c2) /\ (unchanged_at (locations_of_locations_with_values c1) sb1 sb2) /\ (unchanged_at (locations_of_locations_with_values c2) sb1 sb2) /\ (unchanged_at a1 sa1 sb2) /\ (unchanged_except a2 sa1 sb1) /\ (unchanged_at a2 sa2 sb1) /\ (unchanged_except a1 sa2 sb2))) (ensures ( (unchanged_at (a1 `L.append` a2) sb1 sb2))) = let precond = !!(write_exchange_allowed a1 a2 c1 c2) /\ (unchanged_at (locations_of_locations_with_values c1) sb1 sb2) /\ (unchanged_at (locations_of_locations_with_values c2) sb1 sb2) /\ (unchanged_at a1 sa1 sb2) /\ (unchanged_except a2 sa1 sb1) /\ (unchanged_at a2 sa2 sb1) /\ (unchanged_except a1 sa2 sb2) in let aux1 a : Lemma (requires (L.mem a a1 /\ precond)) (ensures (eval_location a sb1 == eval_location a sb2)) = if L.mem a (locations_of_locations_with_values c1) then ( lemma_unchanged_at_mem (locations_of_locations_with_values c1) a sb1 sb2 ) else ( lemma_for_all_elim (aux_write_exchange_allowed a2 c1 c2) a1; L.mem_memP a a1; assert !!(aux_write_exchange_allowed a2 c1 c2 a); assert !!(disjoint_location_from_locations a a2); assert (eval_location a sb1 == eval_location a sa1); lemma_unchanged_at_mem a1 a sa1 sb2 ) in let aux2 a : Lemma (requires (L.mem a a2 /\ precond)) (ensures (eval_location a sb1 == eval_location a sb2)) = if L.mem a (locations_of_locations_with_values c2) then ( lemma_unchanged_at_mem (locations_of_locations_with_values c2) a sb1 sb2 ) else ( lemma_write_exchange_allowed_symmetric a1 a2 c1 c2; lemma_for_all_elim (aux_write_exchange_allowed a1 c2 c1) a2; L.mem_memP a a2; assert !!(aux_write_exchange_allowed a1 c2 c1 a); assert !!(disjoint_location_from_locations a a1); assert (eval_location a sb2 == eval_location a sa2); lemma_unchanged_at_mem a2 a sa2 sb1 ) in let rec aux a1' a1'' a2' a2'' : Lemma (requires (a1' `L.append` a1'' == a1 /\ a2' `L.append` a2'' == a2 /\ precond)) (ensures (unchanged_at (a1'' `L.append` a2'') sb1 sb2)) (decreases %[a1''; a2'']) = match a1'' with | [] -> ( match a2'' with | [] -> () | y :: ys -> ( L.append_l_cons y ys a2'; L.append_mem a2' a2'' y; aux2 y; aux a1' a1'' (a2' `L.append` [y]) ys ) ) | x :: xs -> L.append_l_cons x xs a1'; L.append_mem a1' a1'' x; aux1 x; aux (a1' `L.append` [x]) xs a2' a2'' in aux [] a1 [] a2 let lemma_unchanged_except_same_transitive (as0:list location) (s1 s2 s3:machine_state) : Lemma (requires ( (unchanged_except as0 s1 s2) /\ (unchanged_except as0 s2 s3))) (ensures ( (unchanged_except as0 s1 s3))) = () let rec lemma_unchanged_at_and_except (as0:list location) (s1 s2:machine_state) : Lemma (requires ( (unchanged_at as0 s1 s2) /\ (unchanged_except as0 s1 s2))) (ensures ( (unchanged_except [] s1 s2))) = match as0 with | [] -> () | x :: xs -> lemma_unchanged_at_and_except xs s1 s2 let lemma_equiv_states_when_except_none (s1 s2:machine_state) (ok:bool) : Lemma (requires ( (unchanged_except [] s1 s2))) (ensures ( (equiv_states ({s1 with ms_ok=ok}) ({s2 with ms_ok=ok})))) = assert_norm (cf s2.ms_flags == cf (filter_state s2 s1.ms_flags ok []).ms_flags); (* OBSERVE *) assert_norm (overflow s2.ms_flags == overflow (filter_state s2 s1.ms_flags ok []).ms_flags); (* OBSERVE *) lemma_locations_complete s1 s2 s1.ms_flags ok [] #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_mem_not_disjoint (a:location) (as1 as2:list location) : Lemma (requires (L.mem a as1 /\ L.mem a as2)) (ensures ( (not !!(disjoint_locations as1 as2)))) = match as1, as2 with | [_], [_] -> () | [_], y :: ys -> if a = y then () else ( lemma_mem_not_disjoint a as1 ys ) | x :: xs, y :: ys -> if a = x then ( if a = y then () else ( lemma_mem_not_disjoint a as1 ys; lemma_disjoint_locations_symmetric as1 as2; lemma_disjoint_locations_symmetric as1 ys ) ) else ( lemma_mem_not_disjoint a xs as2 ) #pop-options let lemma_bounded_effects_means_same_ok (rw:rw_set) (f:st unit) (s1 s2 s1' s2':machine_state) : Lemma (requires ( (bounded_effects rw f) /\ (s1.ms_ok = s2.ms_ok) /\ (unchanged_at rw.loc_reads s1 s2) /\ (s1' == run f s1) /\ (s2' == run f s2))) (ensures ( ((run f s1).ms_ok = (run f s2).ms_ok))) = () let lemma_both_not_ok (f1 f2:st unit) (rw1 rw2:rw_set) (s:machine_state) : Lemma (requires ( (bounded_effects rw1 f1) /\ (bounded_effects rw2 f2) /\ !!(rw_exchange_allowed rw1 rw2))) (ensures ( (run2 f1 f2 s).ms_ok = (run2 f2 f1 s).ms_ok)) = if (run f1 s).ms_ok then ( lemma_disjoint_implies_unchanged_at rw2.loc_reads rw1.loc_writes s (run f1 s) ) else (); if (run f2 s).ms_ok then ( lemma_disjoint_implies_unchanged_at rw1.loc_reads rw2.loc_writes s (run f2 s) ) else () #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let lemma_constant_on_execution_stays_constant (f1 f2:st unit) (rw1 rw2:rw_set) (s s1 s2:machine_state) : Lemma (requires ( s1.ms_ok /\ s2.ms_ok /\ (run f1 s1).ms_ok /\ (run f2 s2).ms_ok /\ (bounded_effects rw1 f1) /\ (bounded_effects rw2 f2) /\ (s1 == run f2 s) /\ (s2 == run f1 s) /\ !!(write_exchange_allowed rw1.loc_writes rw2.loc_writes rw1.loc_constant_writes rw2.loc_constant_writes))) (ensures ( unchanged_at (locations_of_locations_with_values rw1.loc_constant_writes) (run f1 s1) (run f2 s2) /\ unchanged_at (locations_of_locations_with_values rw2.loc_constant_writes) (run f1 s1) (run f2 s2))) = let precond = s1.ms_ok /\ s2.ms_ok /\ (run f1 s1).ms_ok /\ (run f2 s2).ms_ok /\ (bounded_effects rw1 f1) /\ (bounded_effects rw2 f2) /\ (s1 == run f2 s) /\ (s2 == run f1 s) /\ !!(write_exchange_allowed rw1.loc_writes rw2.loc_writes rw1.loc_constant_writes rw2.loc_constant_writes) in let r1, w1, c1 = rw1.loc_reads, rw1.loc_writes, rw1.loc_constant_writes in let r2, w2, c2 = rw2.loc_reads, rw2.loc_writes, rw2.loc_constant_writes in let cv1, cv2 = locations_of_locations_with_values rw1.loc_constant_writes, locations_of_locations_with_values rw2.loc_constant_writes in let rec aux1 lv lv' : Lemma (requires ( (precond) /\ lv `L.append` lv' == c1)) (ensures ( (unchanged_at (locations_of_locations_with_values lv') (run f1 s1) (run f2 s2)))) (decreases %[lv']) = match lv' with | [] -> () | x :: xs -> let (|l,v|) = x in L.append_mem lv lv' x; lemma_constant_on_execution_mem (lv `L.append` lv') f1 s1 l v; lemma_for_all_elim (aux_write_exchange_allowed w2 c1 c2) w1; assert (eval_location l (run f1 s1) == raise_location_val_eqt v); if L.mem l w2 then ( L.mem_memP l w1; assert !!(aux_write_exchange_allowed w2 c1 c2 l); lemma_mem_not_disjoint l [l] w2; assert (not !!(disjoint_location_from_locations l w2)); //assert (L.mem (coerce l) cv2); assert !!(write_same_constants c1 c2); assert (value_of_const_loc lv' l = v); lemma_write_same_constants_append lv lv' c2; lemma_write_same_constants_mem_both lv' c2 l; lemma_value_of_const_loc_mem c2 l v; lemma_constant_on_execution_mem c2 f2 s2 l v ) else ( assert (constant_on_execution c1 f1 s); lemma_constant_on_execution_mem (lv `L.append` lv') f1 s l v; assert (eval_location l (run f1 s) == raise_location_val_eqt v); assert (unchanged_except w2 s2 (run f2 s2)); lemma_disjoint_location_from_locations_mem1 l w2; assert (!!(disjoint_location_from_locations l w2)); assert (eval_location l (run f2 s2) == raise_location_val_eqt v) ); L.append_l_cons x xs lv; aux1 (lv `L.append` [x]) xs in let rec aux2 lv lv' : Lemma (requires ( (precond) /\ lv `L.append` lv' == c2)) (ensures ( (unchanged_at (locations_of_locations_with_values lv') (run f1 s1) (run f2 s2)))) (decreases %[lv']) = match lv' with | [] -> () | x :: xs -> let (|l,v|) = x in L.append_mem lv lv' x; lemma_constant_on_execution_mem (lv `L.append` lv') f2 s2 l v; lemma_write_exchange_allowed_symmetric w1 w2 c1 c2; lemma_for_all_elim (aux_write_exchange_allowed w1 c2 c1) w2; assert (eval_location l (run f2 s2) == raise_location_val_eqt v); if L.mem l w1 then ( L.mem_memP l w2; assert !!(aux_write_exchange_allowed w1 c2 c1 l); lemma_mem_not_disjoint l [l] w1; assert (not !!(disjoint_location_from_locations l w1)); //assert (L.mem (coerce l) cv1); assert !!(write_same_constants c2 c1); assert (value_of_const_loc lv' l = v); lemma_write_same_constants_append lv lv' c1; lemma_write_same_constants_mem_both lv' c1 l; lemma_value_of_const_loc_mem c1 l v; lemma_constant_on_execution_mem c1 f1 s1 l v ) else ( assert (constant_on_execution c2 f2 s); lemma_constant_on_execution_mem (lv `L.append` lv') f2 s l v; assert (eval_location l (run f2 s) == raise_location_val_eqt v); assert (unchanged_except w1 s1 (run f1 s1)); lemma_disjoint_location_from_locations_mem1 l w1; assert (!!(disjoint_location_from_locations l w1)); assert (eval_location l (run f1 s1) == raise_location_val_eqt v) ); L.append_l_cons x xs lv; aux2 (lv `L.append` [x]) xs in aux1 [] c1; aux2 [] c2 #pop-options let lemma_commute (f1 f2:st unit) (rw1 rw2:rw_set) (s:machine_state) : Lemma (requires ( (bounded_effects rw1 f1) /\ (bounded_effects rw2 f2) /\ !!(rw_exchange_allowed rw1 rw2))) (ensures ( equiv_states_or_both_not_ok (run2 f1 f2 s) (run2 f2 f1 s))) = let s12 = run2 f1 f2 s in let s21 = run2 f2 f1 s in if not s12.ms_ok || not s21.ms_ok then ( lemma_both_not_ok f1 f2 rw1 rw2 s ) else ( let s1 = run f1 s in let s2 = run f2 s in let r1, w1, c1 = rw1.loc_reads, rw1.loc_writes, rw1.loc_constant_writes in let r2, w2, c2 = rw2.loc_reads, rw2.loc_writes, rw2.loc_constant_writes in assert (s12 == run f2 s1 /\ s21 == run f1 s2); lemma_disjoint_implies_unchanged_at r1 w2 s s2; lemma_disjoint_implies_unchanged_at r2 w1 s s1; assert (unchanged_at w1 s1 s21); assert (unchanged_at w2 s2 s12); assert (unchanged_except w2 s s2); assert (unchanged_except w1 s s1); assert (unchanged_except w2 s1 s12); assert (unchanged_except w1 s2 s21); lemma_unchanged_except_transitive w1 w2 s s1 s12; assert (unchanged_except (w1 `L.append` w2) s s12); lemma_unchanged_except_transitive w2 w1 s s2 s21; assert (unchanged_except (w2 `L.append` w1) s s21); lemma_unchanged_except_append_symmetric w1 w2 s s12; lemma_unchanged_except_append_symmetric w2 w1 s s21; lemma_unchanged_except_same_transitive (w1 `L.append` w2) s s12 s21; lemma_write_exchange_allowed_symmetric w1 w2 c1 c2; lemma_constant_on_execution_stays_constant f2 f1 rw2 rw1 s s1 s2; lemma_unchanged_at_combine w1 w2 c1 c2 s1 s2 s12 s21; lemma_unchanged_at_and_except (w1 `L.append` w2) s12 s21; assert (unchanged_except [] s12 s21); assert (s21.ms_ok = s12.ms_ok); lemma_equiv_states_when_except_none s12 s21 s12.ms_ok; assert (equiv_states (run2 f1 f2 s) (run2 f2 f1 s)) ) let wrap_ss (f:machine_state -> machine_state) : st unit = let open Vale.X64.Machine_Semantics_s in let* s = get in set (f s) let wrap_sos (f:machine_state -> option machine_state) : st unit = fun s -> ( match f s with | None -> (), { s with ms_ok = false } | Some s' -> (), s' ) let lemma_feq_bounded_effects (rw:rw_set) (f1 f2:st unit) : Lemma (requires (bounded_effects rw f1 /\ FStar.FunctionalExtensionality.feq f1 f2)) (ensures (bounded_effects rw f2)) = let open FStar.FunctionalExtensionality in assert (only_affects rw.loc_writes f2); let rec aux w s : Lemma (requires (feq f1 f2 /\ constant_on_execution w f1 s)) (ensures (constant_on_execution w f2 s)) [SMTPat (constant_on_execution w f2 s)] = match w with | [] -> () | x :: xs -> aux xs s in assert (forall s. {:pattern (constant_on_execution rw.loc_constant_writes f2 s)} constant_on_execution rw.loc_constant_writes f2 s); assert (forall l v. {:pattern (L.mem (|l,v|) rw.loc_constant_writes); (L.mem l rw.loc_writes)} L.mem (|l,v|) rw.loc_constant_writes ==> L.mem l rw.loc_writes); assert ( forall s1 s2. {:pattern (run f2 s1); (run f2 s2)} ( (s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2) ==> ( ((run f2 s1).ms_ok = (run f2 s2).ms_ok) /\ ((run f2 s1).ms_ok ==> unchanged_at rw.loc_writes (run f2 s1) (run f2 s2)) ) ) ) let rec safely_bounded_code_p (c:code) : bool = match c with | Ins i -> safely_bounded i | Block l -> safely_bounded_codes_p l | IfElse c t f -> false (* Temporarily disabled. TODO: Re-enable this. safely_bounded_code_p t && safely_bounded_code_p f *) | While c b -> false (* Temporarily disabled. TODO: Re-enable this. safely_bounded_code_p b *) and safely_bounded_codes_p (l:codes) : bool = match l with | [] -> true | x :: xs -> safely_bounded_code_p x && safely_bounded_codes_p xs type safely_bounded_ins = (i:ins{safely_bounded i}) type safely_bounded_code = (c:code{safely_bounded_code_p c}) type safely_bounded_codes = (c:codes{safely_bounded_codes_p c}) let lemma_machine_eval_ins_bounded_effects (i:safely_bounded_ins) : Lemma (ensures (bounded_effects (rw_set_of_ins i) (wrap_ss (machine_eval_ins i)))) = lemma_machine_eval_ins_st_bounded_effects i; lemma_feq_bounded_effects (rw_set_of_ins i) (machine_eval_ins_st i) (wrap_ss (machine_eval_ins i)) let lemma_machine_eval_ins_st_exchange (i1 i2 : ins) (s : machine_state) : Lemma (requires (!!(ins_exchange_allowed i1 i2))) (ensures (commutes s (machine_eval_ins_st i1) (machine_eval_ins_st i2))) = lemma_machine_eval_ins_st_bounded_effects i1; lemma_machine_eval_ins_st_bounded_effects i2; let rw1 = rw_set_of_ins i1 in let rw2 = rw_set_of_ins i2 in lemma_commute (machine_eval_ins_st i1) (machine_eval_ins_st i2) rw1 rw2 s let lemma_instruction_exchange' (i1 i2 : ins) (s1 s2 : machine_state) : Lemma (requires ( !!(ins_exchange_allowed i1 i2) /\ (equiv_states s1 s2))) (ensures ( (let s1', s2' = machine_eval_ins i2 (machine_eval_ins i1 s1), machine_eval_ins i1 (machine_eval_ins i2 s2) in equiv_states_or_both_not_ok s1' s2'))) = lemma_machine_eval_ins_st_exchange i1 i2 s1; lemma_eval_ins_equiv_states i2 s1 s2; lemma_eval_ins_equiv_states i1 (machine_eval_ins i2 s1) (machine_eval_ins i2 s2) let lemma_instruction_exchange (i1 i2 : ins) (s1 s2 : machine_state) : Lemma (requires ( !!(ins_exchange_allowed i1 i2) /\ (equiv_states s1 s2))) (ensures ( (let s1', s2' = machine_eval_ins i2 (filt_state (machine_eval_ins i1 (filt_state s1))), machine_eval_ins i1 (filt_state (machine_eval_ins i2 (filt_state s2))) in equiv_states_or_both_not_ok s1' s2'))) = lemma_eval_ins_equiv_states i1 s1 (filt_state s1); lemma_eval_ins_equiv_states i2 s2 (filt_state s2); lemma_eval_ins_equiv_states i2 (machine_eval_ins i1 (filt_state s1)) (filt_state (machine_eval_ins i1 (filt_state s1))); lemma_eval_ins_equiv_states i1 (machine_eval_ins i2 (filt_state s2)) (filt_state (machine_eval_ins i2 (filt_state s2))); lemma_eval_ins_equiv_states i2 (machine_eval_ins i1 s1) (machine_eval_ins i1 (filt_state s1)); lemma_eval_ins_equiv_states i1 (machine_eval_ins i2 s2) (machine_eval_ins i2 (filt_state s2)); lemma_instruction_exchange' i1 i2 s1 s2 /// Not-ok states lead to erroring states upon execution #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec lemma_not_ok_propagate_code (c:code) (fuel:nat) (s:machine_state) : Lemma (requires (not s.ms_ok)) (ensures (erroring_option_state (machine_eval_code c fuel s))) (decreases %[fuel; c; 1]) = match c with | Ins _ -> reveal_opaque (`%machine_eval_code_ins) machine_eval_code_ins | Block l -> lemma_not_ok_propagate_codes l fuel s | IfElse ifCond ifTrue ifFalse -> let (s', b) = machine_eval_ocmp s ifCond in if b then lemma_not_ok_propagate_code ifTrue fuel s' else lemma_not_ok_propagate_code ifFalse fuel s' | While _ _ -> lemma_not_ok_propagate_while c fuel s and lemma_not_ok_propagate_codes (l:codes) (fuel:nat) (s:machine_state) : Lemma (requires (not s.ms_ok)) (ensures (erroring_option_state (machine_eval_codes l fuel s))) (decreases %[fuel; l]) = match l with | [] -> () | x :: xs -> lemma_not_ok_propagate_code x fuel s; match machine_eval_code x fuel s with | None -> () | Some s -> lemma_not_ok_propagate_codes xs fuel s and lemma_not_ok_propagate_while (c:code{While? c}) (fuel:nat) (s:machine_state) : Lemma (requires (not s.ms_ok)) (ensures (erroring_option_state (machine_eval_code c fuel s))) (decreases %[fuel; c; 0]) = if fuel = 0 then () else ( let While cond body = c in let (s, b) = machine_eval_ocmp s cond in if not b then () else ( lemma_not_ok_propagate_code body (fuel - 1) s ) ) #pop-options /// Given that we have bounded instructions, we can compute bounds on /// [code] and [codes]. let rec rw_set_of_code (c:safely_bounded_code) : rw_set = match c with | Ins i -> rw_set_of_ins i | Block l -> rw_set_of_codes l | IfElse c t f -> add_r_to_rw_set (locations_of_ocmp c) (rw_set_in_parallel (rw_set_of_code t) (rw_set_of_code f)) | While c b -> { add_r_to_rw_set (locations_of_ocmp c) (rw_set_of_code b) with loc_constant_writes = [] (* Since the loop may not execute, we are not sure of any constant writes *) } and rw_set_of_codes (c:safely_bounded_codes) : rw_set = match c with | [] -> { loc_reads = []; loc_writes = []; loc_constant_writes = []; } | x :: xs -> rw_set_in_series (rw_set_of_code x) (rw_set_of_codes xs) let lemma_bounded_effects_on_functional_extensionality (rw:rw_set) (f1 f2:st unit) : Lemma (requires (FStar.FunctionalExtensionality.feq f1 f2 /\ bounded_effects rw f1)) (ensures (bounded_effects rw f2)) = let pre = FStar.FunctionalExtensionality.feq f1 f2 /\ bounded_effects rw f1 in assert (only_affects rw.loc_writes f1 <==> only_affects rw.loc_writes f2); let rec aux c s : Lemma (requires (pre /\ constant_on_execution c f1 s)) (ensures (constant_on_execution c f2 s)) = match c with | [] -> () | (|l,v|) :: xs -> aux xs s in let aux = FStar.Classical.move_requires (aux rw.loc_constant_writes) in FStar.Classical.forall_intro aux; let aux s1 s2 : Lemma (requires (pre /\ s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2 /\ (run f2 s1).ms_ok)) (ensures (unchanged_at rw.loc_writes (run f2 s1) (run f2 s2))) = () in let aux s1 = FStar.Classical.move_requires (aux s1) in FStar.Classical.forall_intro_2 aux let lemma_only_affects_to_unchanged_except locs f s : (* REVIEW: Why is this even needed?! *) Lemma (requires (only_affects locs f /\ (run f s).ms_ok)) (ensures (unchanged_except locs s (run f s))) = () let lemma_equiv_code_codes (c:code) (cs:codes) (fuel:nat) (s:machine_state) : Lemma (ensures ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in equiv_states_or_both_not_ok (run (f1;* f2) s) (run f12 s))) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let s_1 = run f1 s in let s_1_2 = run f2 s_1 in let s_12 = run (f1;* f2) s in let s12 = run f12 s in assert (s_12 == {s_1_2 with ms_ok = s.ms_ok && s_1.ms_ok && s_1_2.ms_ok}); if s.ms_ok then ( if s_1.ms_ok then () else ( lemma_not_ok_propagate_codes cs fuel s_1 ) ) else ( lemma_not_ok_propagate_code c fuel s; lemma_not_ok_propagate_codes cs fuel s_1; lemma_not_ok_propagate_codes (c :: cs) fuel s ) let lemma_bounded_effects_code_codes_aux1 (c:code) (cs:codes) (rw:rw_set) (fuel:nat) s a : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in (bounded_effects rw (f1 ;* f2)) /\ !!(disjoint_location_from_locations a rw.loc_writes) /\ (run f12 s).ms_ok)) (ensures ( let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in eval_location a s == eval_location a (run f12 s))) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = (f1;*f2) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let s_12 = run (f1;*f2) s in let s12 = run f12 s in lemma_equiv_code_codes c cs fuel s; assert (equiv_states_or_both_not_ok s_12 s12); lemma_only_affects_to_unchanged_except rw.loc_writes f s let rec lemma_bounded_effects_code_codes_aux2 (c:code) (cs:codes) (fuel:nat) cw s : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in (constant_on_execution cw (f1;*f2) s))) (ensures ( let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in (constant_on_execution cw f12 s))) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = (f1;*f2) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in lemma_equiv_code_codes c cs fuel s; if (run f s).ms_ok then ( match cw with | [] -> () | (|l, v|) :: xs -> ( lemma_bounded_effects_code_codes_aux2 c cs fuel xs s ) ) else () let lemma_unchanged_at_reads_implies_both_ok_equal (rw:rw_set) (f:st unit) s1 s2 : (* REVIEW: Why is this necessary?! *) Lemma (requires (bounded_effects rw f /\ s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2)) (ensures ( ((run f s1).ms_ok = (run f s2).ms_ok) /\ ((run f s1).ms_ok ==> unchanged_at rw.loc_writes (run f s1) (run f s2)))) = () let lemma_bounded_effects_code_codes_aux3 (c:code) (cs:codes) (rw:rw_set) (fuel:nat) s1 s2 : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in (bounded_effects rw (f1 ;* f2)) /\ s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2)) (ensures ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in (run f12 s1).ms_ok = (run f12 s2).ms_ok /\ (run (f1 ;* f2) s1).ms_ok = (run f12 s1).ms_ok)) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = (f1;*f2) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let pre = bounded_effects rw f in lemma_equiv_code_codes c cs fuel s1; lemma_equiv_code_codes c cs fuel s2; assert ((run f s1).ms_ok == (run f12 s1).ms_ok); assert ((run f s2).ms_ok == (run f12 s2).ms_ok); lemma_unchanged_at_reads_implies_both_ok_equal rw f s1 s2 let lemma_bounded_effects_code_codes_aux4 (c:code) (cs:codes) (rw:rw_set) (fuel:nat) s1 s2 : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in (bounded_effects rw (f1 ;* f2)) /\ s1.ms_ok = s2.ms_ok /\ unchanged_at rw.loc_reads s1 s2 /\ (run (f1 ;* f2) s1).ms_ok)) (ensures ( let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in unchanged_at rw.loc_writes (run f12 s1) (run f12 s2))) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = (f1;*f2) in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let pre = bounded_effects rw f in lemma_equiv_code_codes c cs fuel s1; lemma_equiv_code_codes c cs fuel s2; lemma_unchanged_at_reads_implies_both_ok_equal rw f s1 s2; assert (run f12 s1).ms_ok; assert (run f12 s2).ms_ok; assert (unchanged_at rw.loc_writes (run f s1) (run f s2)); assert (run f s1 == run f12 s1); assert (run f s2 == run f12 s2) let lemma_bounded_effects_code_codes (c:code) (cs:codes) (rw:rw_set) (fuel:nat) : Lemma (requires ( let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in (bounded_effects rw (f1 ;* f2)))) (ensures ( let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in bounded_effects rw f12)) = let open Vale.X64.Machine_Semantics_s in let f1 = wrap_sos (machine_eval_code c fuel) in let f2 = wrap_sos (machine_eval_codes cs fuel) in let f = f1;*f2 in let f12 = wrap_sos (machine_eval_codes (c :: cs) fuel) in let pre = bounded_effects rw f in let aux s = FStar.Classical.move_requires (lemma_bounded_effects_code_codes_aux1 c cs rw fuel s) in FStar.Classical.forall_intro_2 aux; let aux = FStar.Classical.move_requires (lemma_bounded_effects_code_codes_aux2 c cs fuel rw.loc_constant_writes) in FStar.Classical.forall_intro aux; let aux s1 = FStar.Classical.move_requires (lemma_bounded_effects_code_codes_aux3 c cs rw fuel s1) in FStar.Classical.forall_intro_2 aux; let aux s1 = FStar.Classical.move_requires (lemma_bounded_effects_code_codes_aux4 c cs rw fuel s1) in FStar.Classical.forall_intro_2 aux let rec lemma_bounded_code (c:safely_bounded_code) (fuel:nat) : Lemma (ensures (bounded_effects (rw_set_of_code c) (wrap_sos (machine_eval_code c fuel)))) (decreases %[c]) = match c with | Ins i -> reveal_opaque (`%machine_eval_code_ins) machine_eval_code_ins; lemma_machine_eval_code_Ins_bounded_effects i fuel; lemma_bounded_effects_on_functional_extensionality (rw_set_of_ins i) (fun s -> (), (Some?.v (machine_eval_code_ins_def i s))) (wrap_sos (machine_eval_code c fuel)) | Block l -> lemma_bounded_codes l fuel; lemma_bounded_effects_on_functional_extensionality (rw_set_of_codes l) (wrap_sos (machine_eval_codes l fuel)) (wrap_sos (machine_eval_code (Block l) fuel)) | IfElse c t f -> () | While c b -> () and lemma_bounded_codes (c:safely_bounded_codes) (fuel:nat) : Lemma (ensures (bounded_effects (rw_set_of_codes c) (wrap_sos (machine_eval_codes c fuel)))) (decreases %[c]) = let open Vale.X64.Machine_Semantics_s in match c with | [] -> () | x :: xs -> lemma_bounded_code x fuel; lemma_bounded_codes xs fuel; lemma_bounded_effects_series (rw_set_of_code x) (rw_set_of_codes xs) (wrap_sos (machine_eval_code x fuel)) (wrap_sos (machine_eval_codes xs fuel)); lemma_bounded_effects_code_codes x xs (rw_set_of_codes c) fuel /// Given that we can perform simple swaps between instructions, we /// can do swaps between [code]s. let code_exchange_allowed (c1 c2:safely_bounded_code) : pbool = rw_exchange_allowed (rw_set_of_code c1) (rw_set_of_code c2) /+> normal (" for instructions " ^ fst (print_code c1 0 gcc) ^ " and " ^ fst (print_code c2 0 gcc)) #push-options "--initial_fuel 3 --max_fuel 3 --initial_ifuel 0 --max_ifuel 0" let lemma_code_exchange_allowed (c1 c2:safely_bounded_code) (fuel:nat) (s:machine_state) : Lemma (requires ( !!(code_exchange_allowed c1 c2))) (ensures ( equiv_option_states (machine_eval_codes [c1; c2] fuel s) (machine_eval_codes [c2; c1] fuel s))) = lemma_bounded_code c1 fuel; lemma_bounded_code c2 fuel; let f1 = wrap_sos (machine_eval_code c1 fuel) in let f2 = wrap_sos (machine_eval_code c2 fuel) in lemma_commute f1 f2 (rw_set_of_code c1) (rw_set_of_code c2) s; assert (equiv_states_or_both_not_ok (run2 f1 f2 s) (run2 f2 f1 s)); let s1 = run f1 s in let s12 = run f2 s1 in let s2 = run f2 s in let s21 = run f1 s2 in allow_inversion (option machine_state); FStar.Classical.move_requires (lemma_not_ok_propagate_code c1 fuel) s; FStar.Classical.move_requires (lemma_not_ok_propagate_code c2 fuel) s1; FStar.Classical.move_requires (lemma_not_ok_propagate_code c2 fuel) s; FStar.Classical.move_requires (lemma_not_ok_propagate_code c1 fuel) s2; FStar.Classical.move_requires (lemma_not_ok_propagate_codes [c1;c2] fuel) s; FStar.Classical.move_requires (lemma_not_ok_propagate_codes [c2;c1] fuel) s #pop-options /// Given that we can perform simple swaps between [code]s, we can /// define a relation that tells us if some [codes] can be transformed /// into another using only allowed swaps. #push-options "--initial_fuel 2 --max_fuel 2 --initial_ifuel 1 --max_ifuel 1" let rec bubble_to_top (cs:codes) (i:nat{i < L.length cs}) : possibly (cs':codes{ let a, b, c = L.split3 cs i in cs' == L.append a c /\ L.length cs' = L.length cs - 1 }) = match cs with | [_] -> return [] | h :: t -> if i = 0 then ( return t ) else ( let x = L.index cs i in if not (safely_bounded_code_p x) then ( Err ("Cannot safely move " ^ fst (print_code x 0 gcc)) ) else ( if not (safely_bounded_code_p h) then ( Err ("Cannot safely move beyond " ^ fst (print_code h 0 gcc)) ) else ( match bubble_to_top t (i - 1) with | Err reason -> Err reason | Ok res -> match code_exchange_allowed x h with | Err reason -> Err reason | Ok () -> return (h :: res) ) ) ) #pop-options let rec num_blocks_in_codes (c:codes) : nat = match c with | [] -> 0 | Block l :: t -> 1 + num_blocks_in_codes l + num_blocks_in_codes t | _ :: t -> num_blocks_in_codes t let rec lemma_num_blocks_in_codes_append (c1 c2:codes) : Lemma (ensures (num_blocks_in_codes (c1 `L.append` c2) == num_blocks_in_codes c1 + num_blocks_in_codes c2)) [SMTPat (num_blocks_in_codes (c1 `L.append` c2))] = match c1 with | [] -> () | x :: xs -> lemma_num_blocks_in_codes_append xs c2 type transformation_hint = | MoveUpFrom : p:nat -> transformation_hint | DiveInAt : p:nat -> q:transformation_hint -> transformation_hint | InPlaceIfElse : ifTrue:transformation_hints -> ifFalse:transformation_hints -> transformation_hint | InPlaceWhile : whileBody:transformation_hints -> transformation_hint and transformation_hints = list transformation_hint let rec string_of_transformation_hint (th:transformation_hint) : Tot string (decreases %[th]) = match th with | MoveUpFrom p -> "(MoveUpFrom " ^ string_of_int p ^ ")" | DiveInAt p q -> "(DiveInAt " ^ string_of_int p ^ " " ^ string_of_transformation_hint q ^ ")" | InPlaceIfElse tr fa -> "(InPlaceIfElse " ^ string_of_transformation_hints tr ^ " " ^ string_of_transformation_hints fa ^ ")" | InPlaceWhile bo -> "(InPlaceWhile " ^ string_of_transformation_hints bo ^ ")" and aux_string_of_transformation_hints (ts:transformation_hints) : Tot string (decreases %[ts; 0]) = match ts with | [] -> "" | x :: xs -> string_of_transformation_hint x ^ "; " ^ aux_string_of_transformation_hints xs and string_of_transformation_hints (ts:transformation_hints) : Tot string (decreases %[ts; 1]) = "[" ^ aux_string_of_transformation_hints ts ^ "]" let rec wrap_diveinat (p:nat) (l:transformation_hints) : transformation_hints = match l with | [] -> [] | x :: xs -> DiveInAt p x :: wrap_diveinat p xs (* XXX: Copied from List.Tot.Base because of an extraction issue. See https://github.com/FStarLang/FStar/pull/1822. *) val split3: #a:Type -> l:list a -> i:nat{i < L.length l} -> Tot (list a * a * list a) let split3 #a l i = let a, as0 = L.splitAt i l in L.lemma_splitAt_snd_length i l; let b :: c = as0 in a, b, c let rec is_empty_code (c:code) : bool = match c with | Ins _ -> false | Block l -> is_empty_codes l | IfElse _ t f -> false | While _ c -> false and is_empty_codes (c:codes) : bool = match c with | [] -> true | x :: xs -> is_empty_code x && is_empty_codes xs let rec perform_reordering_with_hint (t:transformation_hint) (c:codes) : possibly codes = match c with | [] -> Err "trying to transform empty code" | x :: xs -> if is_empty_codes [x] then perform_reordering_with_hint t xs else ( match t with | MoveUpFrom i -> ( if i < L.length c then ( let+ c'= bubble_to_top c i in return (L.index c i :: c') ) else ( Err ("invalid hint : " ^ string_of_transformation_hint t) ) ) | DiveInAt i t' -> if i < L.length c then ( FStar.List.Pure.lemma_split3_length c i; let left, mid, right = split3 c i in match mid with | Block l -> let+ l' = perform_reordering_with_hint t' l in ( match l' with | [] -> Err "impossible" | y :: ys -> L.append_length left [y]; let+ left' = bubble_to_top (left `L.append` [y]) i in return (y :: (left' `L.append` (Block ys :: right))) ) | _ -> Err ("trying to dive into a non-block : " ^ string_of_transformation_hint t ^ " " ^ fst (print_code (Block c) 0 gcc)) ) else ( Err ("invalid hint : " ^ string_of_transformation_hint t) ) | InPlaceIfElse tht thf -> ( match x with | IfElse c (Block t) (Block f) -> let+ tt = perform_reordering_with_hints tht t in let+ ff = perform_reordering_with_hints thf f in return (IfElse c (Block tt) (Block ff) :: xs) | _ -> Err ("Invalid hint : " ^ string_of_transformation_hint t ^ " for codes " ^ fst (print_code (Block c) 0 gcc)) ) | InPlaceWhile thb -> ( match x with | While c (Block b) -> let+ bb = perform_reordering_with_hints thb b in return (While c (Block bb) :: xs) | _ -> Err ("Invalid hint : " ^ string_of_transformation_hint t ^ " for codes " ^ fst (print_code (Block c) 0 gcc)) ) ) and perform_reordering_with_hints (ts:transformation_hints) (c:codes) : possibly codes = (* let _ = IO.debug_print_string ( "-----------------------------\n" ^ " th : " ^ string_of_transformation_hints ts ^ "\n" ^ " c :\n" ^ fst (print_code (Block c) 0 gcc) ^ "\n" ^ "-----------------------------\n" ^ "") in *) match ts with | [] -> ( if is_empty_codes c then ( return [] ) else ( (* let _ = IO.debug_print_string ( "failed here!!!\n" ^ "\n") in *) Err ("no more transformation hints for " ^ fst (print_code (Block c) 0 gcc)) ) ) | t :: ts' -> let+ c' = perform_reordering_with_hint t c in match c' with | [] -> Err "impossible" | x :: xs -> if is_empty_codes [x] then ( Err "Trying to move 'empty' code." ) else ( (* let _ = IO.debug_print_string ( "dragged up: \n" ^ fst (print_code x 0 gcc) ^ "\n") in *) let+ xs' = perform_reordering_with_hints ts' xs in return (x :: xs') ) (* NOTE: We assume this function since it is not yet exposed. Once exposed from the instructions module, we should be able to remove it from here. Also, note that we don't require any other properties from [eq_ins]. It is an uninterpreted function that simply gives us a "hint" to find equivalent instructions! For testing purposes, we have it set to an [irreducible] function that looks at the printed representation of the instructions. Since it is irreducible, no other function should be able to "look into" the definition of this function, but instead should be limited only to its signature. However, the OCaml extraction _should_ be able to peek inside, and be able to proceed. *) irreducible let eq_ins (i1 i2:ins) : bool = print_ins i1 gcc = print_ins i2 gcc let rec eq_code (c1 c2:code) : bool = match c1, c2 with | Ins i1, Ins i2 -> eq_ins i1 i2 | Block l1, Block l2 -> eq_codes l1 l2 | IfElse c1 t1 f1, IfElse c2 t2 f2 -> c1 = c2 && eq_code t1 t2 && eq_code f1 f2 | While c1 b1, While c2 b2 -> c1 = c2 && eq_code b1 b2 | _, _ -> false and eq_codes (c1 c2:codes) : bool = match c1, c2 with | [], [] -> true | _, [] | [], _ -> false | x :: xs, y :: ys -> eq_code x y && eq_codes xs ys let rec fully_unblocked_code (c:code) : codes = match c with | Ins i -> [c] | Block l -> fully_unblocked_codes l | IfElse c t f -> [IfElse c (Block (fully_unblocked_code t)) (Block (fully_unblocked_code f))] | While c b -> [While c (Block (fully_unblocked_code b))] and fully_unblocked_codes (c:codes) : codes = match c with | [] -> [] | x :: xs -> fully_unblocked_code x `L.append` fully_unblocked_codes xs let increment_hint (th:transformation_hint) : transformation_hint = match th with | MoveUpFrom p -> MoveUpFrom (p + 1) | DiveInAt p q -> DiveInAt (p + 1) q | _ -> th let rec find_deep_code_transform (c:code) (cs:codes) : possibly transformation_hint = match cs with | [] -> Err ("Not found (during find_deep_code_transform): " ^ fst (print_code c 0 gcc)) | x :: xs -> (* let _ = IO.debug_print_string ( "---------------------------------\n" ^ " c : \n" ^ fst (print_code c 0 gcc) ^ "\n" ^ " x : \n" ^ fst (print_code x 0 gcc) ^ "\n" ^ " xs : \n" ^ fst (print_code (Block xs) 0 gcc) ^ "\n" ^ "---------------------------------\n" ^ "") in *) if is_empty_code x then find_deep_code_transform c xs else ( if eq_codes (fully_unblocked_code x) (fully_unblocked_code c) then ( return (MoveUpFrom 0) ) else ( match x with | Block l -> ( match find_deep_code_transform c l with | Ok t -> return (DiveInAt 0 t) | Err reason -> let+ th = find_deep_code_transform c xs in return (increment_hint th) ) | _ -> let+ th = find_deep_code_transform c xs in return (increment_hint th) ) ) let rec metric_for_code (c:code) : GTot nat = 1 + ( match c with | Ins _ -> 0 | Block l -> metric_for_codes l | IfElse _ t f -> metric_for_code t + metric_for_code f | While _ b -> metric_for_code b ) and metric_for_codes (c:codes) : GTot nat = match c with | [] -> 0 | x :: xs -> 1 + metric_for_code x + metric_for_codes xs let rec lemma_metric_for_codes_append (c1 c2:codes) : Lemma (ensures (metric_for_codes (c1 `L.append` c2) == metric_for_codes c1 + metric_for_codes c2)) [SMTPat (metric_for_codes (c1 `L.append` c2))] = match c1 with | [] -> () | x :: xs -> lemma_metric_for_codes_append xs c2 irreducible (* Our proofs do not depend on how the hints are found. As long as some hints are provided, we validate the hints to perform the transformation and use it. Thus, we make this function [irreducible] to explicitly prevent any of the proofs from reasoning about it. *) let rec find_transformation_hints (c1 c2:codes) : Tot (possibly transformation_hints) (decreases %[metric_for_codes c2; metric_for_codes c1]) = let e1, e2 = is_empty_codes c1, is_empty_codes c2 in if e1 && e2 then ( return [] ) else if e2 then ( Err ("non empty first code: " ^ fst (print_code (Block c1) 0 gcc)) ) else if e1 then ( Err ("non empty second code: " ^ fst (print_code (Block c2) 0 gcc)) ) else ( let h1 :: t1 = c1 in let h2 :: t2 = c2 in assert (metric_for_codes c2 >= metric_for_code h2); (* OBSERVE *) if is_empty_code h1 then ( find_transformation_hints t1 c2 ) else if is_empty_code h2 then ( find_transformation_hints c1 t2 ) else ( match find_deep_code_transform h2 c1 with | Ok th -> ( match perform_reordering_with_hint th c1 with | Ok (h1 :: t1) -> let+ t_hints2 = find_transformation_hints t1 t2 in return (th :: t_hints2) | Ok [] -> Err "Impossible" | Err reason -> Err ("Unable to find valid movement for : " ^ fst (print_code h2 0 gcc) ^ ". Reason: " ^ reason) ) | Err reason -> ( let h1 :: t1 = c1 in match h1, h2 with | Block l1, Block l2 -> ( match ( let+ t_hints1 = find_transformation_hints l1 l2 in let+ t_hints2 = find_transformation_hints t1 t2 in return (wrap_diveinat 0 t_hints1 `L.append` t_hints2) ) with | Ok ths -> return ths | Err reason -> find_transformation_hints c1 (l2 `L.append` t2) ) | IfElse co1 (Block tr1) (Block fa1), IfElse co2 (Block tr2) (Block fa2) -> (co1 = co2) /- ("Non-same conditions for IfElse: (" ^ print_cmp co1 0 gcc ^ ") and (" ^ print_cmp co2 0 gcc ^ ")");+ assert (metric_for_code h2 > metric_for_code (Block tr2)); (* OBSERVE *) assert (metric_for_code h2 > metric_for_code (Block fa2)); (* OBSERVE *) let+ tr_hints = find_transformation_hints tr1 tr2 in let+ fa_hints = find_transformation_hints fa1 fa2 in let+ t_hints2 = find_transformation_hints t1 t2 in return (InPlaceIfElse tr_hints fa_hints :: t_hints2) | While co1 (Block bo1), While co2 (Block bo2) -> (co1 = co2) /- ("Non-same conditions for While: (" ^ print_cmp co1 0 gcc ^ ") and (" ^ print_cmp co2 0 gcc ^ ")");+ assert (metric_for_code h2 > metric_for_code (Block bo2)); (* OBSERVE *) let+ bo_hints = find_transformation_hints bo1 bo2 in let+ t_hints2 = find_transformation_hints t1 t2 in return (InPlaceWhile bo_hints :: t_hints2) | Block l1, IfElse _ _ _ | Block l1, While _ _ -> assert (metric_for_codes (l1 `L.append` t1) == metric_for_codes l1 + metric_for_codes t1); (* OBSERVE *) assert_norm (metric_for_codes c1 == 2 + metric_for_codes l1 + metric_for_codes t1); (* OBSERVE *) let+ t_hints1 = find_transformation_hints (l1 `L.append` t1) c2 in ( match t_hints1 with | [] -> Err "Impossible" | th :: _ -> let th = DiveInAt 0 th in match perform_reordering_with_hint th c1 with | Ok (h1 :: t1) -> let+ t_hints2 = find_transformation_hints t1 t2 in return (th :: t_hints2) | Ok [] -> Err "Impossible" | Err reason -> Err ("Failed during left-unblock for " ^ fst (print_code h2 0 gcc) ^ ". Reason: " ^ reason) ) | _, Block l2 -> find_transformation_hints c1 (l2 `L.append` t2) | IfElse _ _ _, IfElse _ _ _ | While _ _, While _ _ -> Err ("Found weird non-standard code: " ^ fst (print_code h1 0 gcc)) | _ -> Err ("Find deep code failure. Reason: " ^ reason) ) ) ) /// If a transformation can be performed, then the result behaves /// identically as per the [equiv_states] relation. #push-options "--z3rlimit 10 --initial_fuel 3 --max_fuel 3 --initial_ifuel 1 --max_ifuel 1" let rec lemma_bubble_to_top (cs : codes) (i:nat{i < L.length cs}) (fuel:nat) (s s' : machine_state) : Lemma (requires ( (s'.ms_ok) /\ (Some s' == machine_eval_codes cs fuel s) /\ (Ok? (bubble_to_top cs i)))) (ensures ( let x = L.index cs i in let Ok xs = bubble_to_top cs i in let s1' = machine_eval_code x fuel s in (Some? s1') /\ ( let Some s1 = s1' in let s2' = machine_eval_codes xs fuel s1 in (Some? s2') /\ ( let Some s2 = s2' in equiv_states s' s2)))) = match cs with | [_] -> () | h :: t -> let x = L.index cs i in let Ok xs = bubble_to_top cs i in if i = 0 then () else ( let Some s_h = machine_eval_code h fuel s in lemma_bubble_to_top (L.tl cs) (i-1) fuel s_h s'; let Some s_h_x = machine_eval_code x fuel s_h in let Some s_hx = machine_eval_codes [h;x] fuel s in assert (s_h_x == s_hx); lemma_code_exchange_allowed x h fuel s; FStar.Classical.move_requires (lemma_not_ok_propagate_codes (L.tl xs) fuel) s_hx; assert (s_hx.ms_ok); let Some s_xh = machine_eval_codes [x;h] fuel s in lemma_eval_codes_equiv_states (L.tl xs) fuel s_hx s_xh ) #pop-options #push-options "--initial_fuel 3 --max_fuel 3 --initial_ifuel 1 --max_ifuel 1" let rec lemma_machine_eval_codes_block_to_append (c1 c2 : codes) (fuel:nat) (s:machine_state) : Lemma (ensures (machine_eval_codes (c1 `L.append` c2) fuel s == machine_eval_codes (Block c1 :: c2) fuel s)) = match c1 with | [] -> () | x :: xs -> match machine_eval_code x fuel s with | None -> () | Some s1 -> lemma_machine_eval_codes_block_to_append xs c2 fuel s1 #pop-options let rec lemma_append_single (xs:list 'a) (y:'a) (i:nat) : Lemma (requires (i == L.length xs)) (ensures ( L.length (xs `L.append` [y]) = L.length xs + 1 /\ L.index (xs `L.append` [y]) i == y)) = match xs with | [] -> () | x :: xs -> lemma_append_single xs y (i - 1) #push-options "--initial_fuel 3 --max_fuel 3 --initial_ifuel 1 --max_ifuel 1" let rec lemma_is_empty_code (c:code) (fuel:nat) (s:machine_state) : Lemma (requires (is_empty_code c)) (ensures ((machine_eval_code c fuel s) == (machine_eval_codes [] fuel s))) = match c with | Ins _ -> () | Block l -> lemma_is_empty_codes l fuel s | IfElse _ t f -> () | While _ c -> () and lemma_is_empty_codes (cs:codes) (fuel:nat) (s:machine_state) : Lemma (requires (is_empty_codes cs)) (ensures ((machine_eval_codes cs fuel s) == (machine_eval_codes [] fuel s))) = match cs with | [] -> () | x :: xs -> lemma_is_empty_code x fuel s; lemma_is_empty_codes xs fuel s #pop-options #restart-solver
{ "checked_file": "/", "dependencies": [ "Vale.X64.Print_s.fst.checked", "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instructions_s.fsti.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.Bytes_Code_s.fst.checked", "Vale.Transformers.Locations.fsti.checked", "Vale.Transformers.BoundedInstructionEffects.fsti.checked", "Vale.Def.PossiblyMonad.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Option.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.List.Pure.fst.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Vale.Transformers.InstructionReorder.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Vale.Transformers.BoundedInstructionEffects", "short_module": null }, { "abbrev": false, "full_module": "Vale.Transformers.Locations", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.PossiblyMonad", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Print_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Bytes_Code_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Transformers", "short_module": null }, { "abbrev": false, "full_module": "Vale.Transformers", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 3, "initial_ifuel": 1, "max_fuel": 3, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ts: Vale.Transformers.InstructionReorder.transformation_hints -> cs: Vale.X64.Machine_Semantics_s.codes -> fuel: Prims.nat -> s: Vale.X64.Machine_Semantics_s.machine_state -> FStar.Pervasives.Lemma (requires Ok? (Vale.Transformers.InstructionReorder.perform_reordering_with_hints ts cs) /\ Some? (Vale.X64.Machine_Semantics_s.machine_eval_codes cs fuel s) /\ Mkmachine_state?.ms_ok (Some?.v (Vale.X64.Machine_Semantics_s.machine_eval_codes cs fuel s)) ) (ensures (let _ = Vale.Transformers.InstructionReorder.perform_reordering_with_hints ts cs in (let Vale.Def.PossiblyMonad.Ok #_ cs' = _ in Vale.Transformers.InstructionReorder.equiv_ostates (Vale.X64.Machine_Semantics_s.machine_eval_codes cs fuel s) (Vale.X64.Machine_Semantics_s.machine_eval_codes cs' fuel s)) <: Type0)) (decreases %[ts;fuel;cs])
FStar.Pervasives.Lemma
[ "lemma", "" ]
[ "lemma_perform_reordering_with_hint", "lemma_perform_reordering_with_hints" ]
[ "Vale.Transformers.InstructionReorder.transformation_hints", "Vale.X64.Machine_Semantics_s.codes", "Prims.nat", "Vale.X64.Machine_Semantics_s.machine_state", "Vale.Transformers.InstructionReorder.lemma_is_empty_codes", "Vale.Transformers.InstructionReorder.transformation_hint", "Prims.list", "Vale.X64.Bytes_Code_s.code_t", "Vale.X64.Machine_Semantics_s.instr_annotation", "Vale.Transformers.InstructionReorder.lemma_perform_reordering_with_hints", "Prims.unit", "FStar.Pervasives.Native.option", "Vale.X64.Machine_Semantics_s.machine_eval_code", "Vale.Def.PossiblyMonad.possibly", "Vale.Transformers.InstructionReorder.perform_reordering_with_hints", "Vale.Transformers.InstructionReorder.lemma_perform_reordering_with_hint", "Vale.Transformers.InstructionReorder.perform_reordering_with_hint", "Vale.X64.Machine_Semantics_s.machine_eval_codes", "Prims.l_and", "Prims.b2t", "Vale.Def.PossiblyMonad.uu___is_Ok", "FStar.Pervasives.Native.uu___is_Some", "Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_ok", "FStar.Pervasives.Native.__proj__Some__item__v", "Prims.squash", "Vale.Transformers.InstructionReorder.equiv_ostates", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "mutual recursion" ]
false
false
true
false
false
let rec lemma_perform_reordering_with_hints (ts: transformation_hints) (cs: codes) (fuel: nat) (s: machine_state) : Lemma (requires ((Ok? (perform_reordering_with_hints ts cs)) /\ (Some? (machine_eval_codes cs fuel s)) /\ (Some?.v (machine_eval_codes cs fuel s)).ms_ok)) (ensures (let Ok cs' = perform_reordering_with_hints ts cs in equiv_ostates (machine_eval_codes cs fuel s) (machine_eval_codes cs' fuel s))) (decreases %[ts;fuel;cs]) =
let c = cs in let Ok cs' = perform_reordering_with_hints ts cs in let Some s' = machine_eval_codes cs fuel s in match ts with | [] -> lemma_is_empty_codes cs fuel s | t :: ts' -> let Ok (x :: xs) = perform_reordering_with_hint t c in lemma_perform_reordering_with_hint t c fuel s; let Ok xs' = perform_reordering_with_hints ts' xs in let Some s1 = machine_eval_code x fuel s in lemma_perform_reordering_with_hints ts' xs fuel s1
false
FStar.Modifies.fst
FStar.Modifies.loc_union_idem
val loc_union_idem (s: loc) : Lemma (loc_union s s == s) [SMTPat (loc_union s s)]
val loc_union_idem (s: loc) : Lemma (loc_union s s == s) [SMTPat (loc_union s s)]
let loc_union_idem = MG.loc_union_idem
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 189, "start_col": 0, "start_line": 189 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_union s s == s) [SMTPat (FStar.Modifies.loc_union s s)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_union_idem", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_union_idem =
MG.loc_union_idem
false
FStar.Modifies.fst
FStar.Modifies.loc_union_loc_none_r
val loc_union_loc_none_r (s: loc) : Lemma (loc_union s loc_none == s) [SMTPat (loc_union s loc_none)]
val loc_union_loc_none_r (s: loc) : Lemma (loc_union s loc_none == s) [SMTPat (loc_union s loc_none)]
let loc_union_loc_none_r = MG.loc_union_loc_none_r
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 50, "end_line": 197, "start_col": 0, "start_line": 197 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_union s FStar.Modifies.loc_none == s) [SMTPat (FStar.Modifies.loc_union s FStar.Modifies.loc_none)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_union_loc_none_r", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_union_loc_none_r =
MG.loc_union_loc_none_r
false
FStar.Modifies.fst
FStar.Modifies.loc_union_comm
val loc_union_comm (s1 s2: loc) : Lemma (loc_union s1 s2 == loc_union s2 s1) [SMTPat (loc_union s1 s2)]
val loc_union_comm (s1 s2: loc) : Lemma (loc_union s1 s2 == loc_union s2 s1) [SMTPat (loc_union s1 s2)]
let loc_union_comm = MG.loc_union_comm
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 191, "start_col": 0, "start_line": 191 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_union s1 s2 == FStar.Modifies.loc_union s2 s1) [SMTPat (FStar.Modifies.loc_union s1 s2)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_union_comm", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_union_comm =
MG.loc_union_comm
false
FStar.Modifies.fst
FStar.Modifies.loc_union_assoc
val loc_union_assoc (s1 s2 s3: loc) : Lemma (loc_union s1 (loc_union s2 s3) == loc_union (loc_union s1 s2) s3)
val loc_union_assoc (s1 s2 s3: loc) : Lemma (loc_union s1 (loc_union s2 s3) == loc_union (loc_union s1 s2) s3)
let loc_union_assoc = MG.loc_union_assoc
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 40, "end_line": 193, "start_col": 0, "start_line": 193 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> s3: FStar.Modifies.loc -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_union s1 (FStar.Modifies.loc_union s2 s3) == FStar.Modifies.loc_union (FStar.Modifies.loc_union s1 s2) s3)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_union_assoc", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_union_assoc =
MG.loc_union_assoc
false
FStar.Modifies.fst
FStar.Modifies.loc_union_loc_none_l
val loc_union_loc_none_l (s: loc) : Lemma (loc_union loc_none s == s) [SMTPat (loc_union loc_none s)]
val loc_union_loc_none_l (s: loc) : Lemma (loc_union loc_none s == s) [SMTPat (loc_union loc_none s)]
let loc_union_loc_none_l = MG.loc_union_loc_none_l
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 50, "end_line": 195, "start_col": 0, "start_line": 195 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_union FStar.Modifies.loc_none s == s) [SMTPat (FStar.Modifies.loc_union FStar.Modifies.loc_none s)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_union_loc_none_l", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_union_loc_none_l =
MG.loc_union_loc_none_l
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_refl
val loc_includes_refl (s: loc) : Lemma (loc_includes s s) [SMTPat (loc_includes s s)]
val loc_includes_refl (s: loc) : Lemma (loc_includes s s) [SMTPat (loc_includes s s)]
let loc_includes_refl = MG.loc_includes_refl
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 44, "end_line": 208, "start_col": 0, "start_line": 208 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_includes s s) [SMTPat (FStar.Modifies.loc_includes s s)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_refl", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_includes_refl =
MG.loc_includes_refl
false
FStar.Modifies.fst
FStar.Modifies.loc_buffer
val loc_buffer (#t: Type) (b: B.buffer t) : GTot loc
val loc_buffer (#t: Type) (b: B.buffer t) : GTot loc
let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 68, "end_line": 200, "start_col": 0, "start_line": 199 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: FStar.Buffer.buffer t -> Prims.GTot FStar.Modifies.loc
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Buffer.buffer", "FStar.ModifiesGen.loc_of_aloc", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.frameOf", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "FStar.Modifies.loc" ]
[]
false
false
false
false
false
let loc_buffer #t b =
MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
false
FStar.Modifies.fst
FStar.Modifies.loc_disjoint
val loc_disjoint (s1 s2: loc) : GTot Type0
val loc_disjoint (s1 s2: loc) : GTot Type0
let loc_disjoint = MG.loc_disjoint
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 34, "end_line": 240, "start_col": 0, "start_line": 240 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.ModifiesGen.loc_disjoint", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
false
true
let loc_disjoint =
MG.loc_disjoint
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_trans
val loc_includes_trans (s1 s2 s3: loc) : Lemma (requires (loc_includes s1 s2 /\ loc_includes s2 s3)) (ensures (loc_includes s1 s3))
val loc_includes_trans (s1 s2 s3: loc) : Lemma (requires (loc_includes s1 s2 /\ loc_includes s2 s3)) (ensures (loc_includes s1 s3))
let loc_includes_trans = MG.loc_includes_trans
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 46, "end_line": 210, "start_col": 0, "start_line": 210 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> s3: FStar.Modifies.loc -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_includes s1 s2 /\ FStar.Modifies.loc_includes s2 s3) (ensures FStar.Modifies.loc_includes s1 s3)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_trans", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_includes_trans =
MG.loc_includes_trans
false
FStar.Modifies.fst
FStar.Modifies.loc_addresses
val loc_addresses (preserve_liveness: bool) (r: HS.rid) (n: Set.set nat) : GTot loc
val loc_addresses (preserve_liveness: bool) (r: HS.rid) (n: Set.set nat) : GTot loc
let loc_addresses = MG.loc_addresses
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 36, "end_line": 202, "start_col": 0, "start_line": 202 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness: Prims.bool -> r: FStar.Monotonic.HyperHeap.rid -> n: FStar.Set.set Prims.nat -> Prims.GTot FStar.Modifies.loc
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.ModifiesGen.loc_addresses", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
false
false
let loc_addresses =
MG.loc_addresses
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_addresses_buffer
val loc_includes_addresses_buffer (#t: Type) (preserve_liveness: bool) (r: HS.rid) (s: Set.set nat) (p: B.buffer t) : Lemma (requires (B.frameOf p == r /\ Set.mem (B.as_addr p) s)) (ensures (loc_includes (loc_addresses preserve_liveness r s) (loc_buffer p))) [SMTPat (loc_includes (loc_addresses preserve_liveness r s) (loc_buffer p))]
val loc_includes_addresses_buffer (#t: Type) (preserve_liveness: bool) (r: HS.rid) (s: Set.set nat) (p: B.buffer t) : Lemma (requires (B.frameOf p == r /\ Set.mem (B.as_addr p) s)) (ensures (loc_includes (loc_addresses preserve_liveness r s) (loc_buffer p))) [SMTPat (loc_includes (loc_addresses preserve_liveness r s) (loc_buffer p))]
let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p)
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 91, "end_line": 227, "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 FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness: Prims.bool -> r: FStar.Monotonic.HyperHeap.rid -> s: FStar.Set.set Prims.nat -> p: FStar.Buffer.buffer t -> FStar.Pervasives.Lemma (requires FStar.Buffer.frameOf p == r /\ FStar.Set.mem (FStar.Buffer.as_addr p) s) (ensures FStar.Modifies.loc_includes (FStar.Modifies.loc_addresses preserve_liveness r s) (FStar.Modifies.loc_buffer p)) [ SMTPat (FStar.Modifies.loc_includes (FStar.Modifies.loc_addresses preserve_liveness r s) (FStar.Modifies.loc_buffer p)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.bool", "FStar.Monotonic.HyperHeap.rid", "FStar.Set.set", "Prims.nat", "FStar.Buffer.buffer", "FStar.ModifiesGen.loc_includes_addresses_aloc", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let loc_includes_addresses_buffer #t preserve_liveness r s p =
MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p)
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_region_buffer
val loc_includes_region_buffer (#t: Type) (preserve_liveness: bool) (s: Set.set HS.rid) (b: B.buffer t) : Lemma (requires (Set.mem (B.frameOf b) s)) (ensures (loc_includes (loc_regions preserve_liveness s) (loc_buffer b))) [SMTPat (loc_includes (loc_regions preserve_liveness s) (loc_buffer b))]
val loc_includes_region_buffer (#t: Type) (preserve_liveness: bool) (s: Set.set HS.rid) (b: B.buffer t) : Lemma (requires (Set.mem (B.frameOf b) s)) (ensures (loc_includes (loc_regions preserve_liveness s) (loc_buffer b))) [SMTPat (loc_includes (loc_regions preserve_liveness s) (loc_buffer b))]
let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 101, "end_line": 230, "start_col": 0, "start_line": 229 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness: Prims.bool -> s: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> b: FStar.Buffer.buffer t -> FStar.Pervasives.Lemma (requires FStar.Set.mem (FStar.Buffer.frameOf b) s) (ensures FStar.Modifies.loc_includes (FStar.Modifies.loc_regions preserve_liveness s) (FStar.Modifies.loc_buffer b)) [ SMTPat (FStar.Modifies.loc_includes (FStar.Modifies.loc_regions preserve_liveness s) (FStar.Modifies.loc_buffer b)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.bool", "FStar.Set.set", "FStar.Monotonic.HyperHeap.rid", "FStar.Buffer.buffer", "FStar.ModifiesGen.loc_includes_region_aloc", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.frameOf", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let loc_includes_region_buffer #t preserve_liveness s b =
MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_none
val loc_includes_none (s: loc) : Lemma (loc_includes s loc_none) [SMTPat (loc_includes s loc_none)]
val loc_includes_none (s: loc) : Lemma (loc_includes s loc_none) [SMTPat (loc_includes s loc_none)]
let loc_includes_none = MG.loc_includes_none
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 44, "end_line": 216, "start_col": 0, "start_line": 216 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_includes s FStar.Modifies.loc_none) [SMTPat (FStar.Modifies.loc_includes s FStar.Modifies.loc_none)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_none", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_includes_none =
MG.loc_includes_none
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_region_addresses
val loc_includes_region_addresses (preserve_liveness1: bool) (preserve_liveness2: bool) (s: Set.set HS.rid) (r: HS.rid) (a: Set.set nat) : Lemma (requires (Set.mem r s)) (ensures (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a))) [SMTPat (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a))]
val loc_includes_region_addresses (preserve_liveness1: bool) (preserve_liveness2: bool) (s: Set.set HS.rid) (r: HS.rid) (a: Set.set nat) : Lemma (requires (Set.mem r s)) (ensures (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a))) [SMTPat (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a))]
let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 76, "end_line": 232, "start_col": 0, "start_line": 232 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness1: Prims.bool -> preserve_liveness2: Prims.bool -> s: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> r: FStar.Monotonic.HyperHeap.rid -> a: FStar.Set.set Prims.nat -> FStar.Pervasives.Lemma (requires FStar.Set.mem r s) (ensures FStar.Modifies.loc_includes (FStar.Modifies.loc_regions preserve_liveness1 s) (FStar.Modifies.loc_addresses preserve_liveness2 r a)) [ SMTPat (FStar.Modifies.loc_includes (FStar.Modifies.loc_regions preserve_liveness1 s) (FStar.Modifies.loc_addresses preserve_liveness2 r a)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_region_addresses", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_includes_region_addresses =
MG.loc_includes_region_addresses #_ #cls
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_region_region
val loc_includes_region_region (preserve_liveness1: bool) (preserve_liveness2: bool) (s1 s2: Set.set HS.rid) : Lemma (requires ((preserve_liveness1 ==> preserve_liveness2) /\ Set.subset s2 s1)) (ensures (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))) [SMTPat (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))]
val loc_includes_region_region (preserve_liveness1: bool) (preserve_liveness2: bool) (s1 s2: Set.set HS.rid) : Lemma (requires ((preserve_liveness1 ==> preserve_liveness2) /\ Set.subset s2 s1)) (ensures (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))) [SMTPat (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))]
let loc_includes_region_region = MG.loc_includes_region_region #_ #cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 70, "end_line": 234, "start_col": 0, "start_line": 234 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness1: Prims.bool -> preserve_liveness2: Prims.bool -> s1: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> s2: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> FStar.Pervasives.Lemma (requires (preserve_liveness1 ==> preserve_liveness2) /\ FStar.Set.subset s2 s1) (ensures FStar.Modifies.loc_includes (FStar.Modifies.loc_regions preserve_liveness1 s1) (FStar.Modifies.loc_regions preserve_liveness2 s2)) [ SMTPat (FStar.Modifies.loc_includes (FStar.Modifies.loc_regions preserve_liveness1 s1) (FStar.Modifies.loc_regions preserve_liveness2 s2)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_region_region", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_includes_region_region =
MG.loc_includes_region_region #_ #cls
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_union_l
val loc_includes_union_l (s1 s2 s: loc) : Lemma (requires (loc_includes s1 s \/ loc_includes s2 s)) (ensures (loc_includes (loc_union s1 s2) s)) [SMTPat (loc_includes (loc_union s1 s2) s)]
val loc_includes_union_l (s1 s2 s: loc) : Lemma (requires (loc_includes s1 s \/ loc_includes s2 s)) (ensures (loc_includes (loc_union s1 s2) s)) [SMTPat (loc_includes (loc_union s1 s2) s)]
let loc_includes_union_l = MG.loc_includes_union_l
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 50, "end_line": 214, "start_col": 0, "start_line": 214 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> s: FStar.Modifies.loc -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_includes s1 s \/ FStar.Modifies.loc_includes s2 s) (ensures FStar.Modifies.loc_includes (FStar.Modifies.loc_union s1 s2) s) [SMTPat (FStar.Modifies.loc_includes (FStar.Modifies.loc_union s1 s2) s)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_union_l", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_includes_union_l =
MG.loc_includes_union_l
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_gsub_buffer_r
val loc_includes_gsub_buffer_r (l: loc) (#t: Type) (b: B.buffer t) (i: UInt32.t) (len: UInt32.t) : Lemma (requires (UInt32.v i + UInt32.v len <= (B.length b) /\ loc_includes l (loc_buffer b))) (ensures (UInt32.v i + UInt32.v len <= (B.length b) /\ loc_includes l (loc_buffer (B.sub b i len)))) [SMTPat (loc_includes l (loc_buffer (B.sub b i len)))]
val loc_includes_gsub_buffer_r (l: loc) (#t: Type) (b: B.buffer t) (i: UInt32.t) (len: UInt32.t) : Lemma (requires (UInt32.v i + UInt32.v len <= (B.length b) /\ loc_includes l (loc_buffer b))) (ensures (UInt32.v i + UInt32.v len <= (B.length b) /\ loc_includes l (loc_buffer (B.sub b i len)))) [SMTPat (loc_includes l (loc_buffer (B.sub b i len)))]
let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len))
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 66, "end_line": 222, "start_col": 0, "start_line": 221 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: FStar.Modifies.loc -> b: FStar.Buffer.buffer t -> i: FStar.UInt32.t -> len: FStar.UInt32.t -> FStar.Pervasives.Lemma (requires FStar.UInt32.v i + FStar.UInt32.v len <= FStar.Buffer.length b /\ FStar.Modifies.loc_includes l (FStar.Modifies.loc_buffer b)) (ensures FStar.UInt32.v i + FStar.UInt32.v len <= FStar.Buffer.length b /\ FStar.Modifies.loc_includes l (FStar.Modifies.loc_buffer (FStar.Buffer.sub b i len))) [ SMTPat (FStar.Modifies.loc_includes l (FStar.Modifies.loc_buffer (FStar.Buffer.sub b i len)) ) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Modifies.loc", "FStar.Buffer.buffer", "FStar.UInt32.t", "FStar.Modifies.loc_includes_trans", "FStar.Modifies.loc_buffer", "FStar.Buffer.sub", "Prims.unit" ]
[]
true
false
true
false
false
let loc_includes_gsub_buffer_r l #t b i len =
loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len))
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_union_r
val loc_includes_union_r (s s1 s2: loc) : Lemma (requires (loc_includes s s1 /\ loc_includes s s2)) (ensures (loc_includes s (loc_union s1 s2))) [SMTPat (loc_includes s (loc_union s1 s2))]
val loc_includes_union_r (s s1 s2: loc) : Lemma (requires (loc_includes s s1 /\ loc_includes s s2)) (ensures (loc_includes s (loc_union s1 s2))) [SMTPat (loc_includes s (loc_union s1 s2))]
let loc_includes_union_r = MG.loc_includes_union_r
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 50, "end_line": 212, "start_col": 0, "start_line": 212 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_includes s s1 /\ FStar.Modifies.loc_includes s s2) (ensures FStar.Modifies.loc_includes s (FStar.Modifies.loc_union s1 s2)) [SMTPat (FStar.Modifies.loc_includes s (FStar.Modifies.loc_union s1 s2))]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_union_r", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_includes_union_r =
MG.loc_includes_union_r
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_buffer
val loc_includes_buffer (#t: Type) (b1 b2: B.buffer t) : Lemma (requires (b1 `B.includes` b2)) (ensures (loc_includes (loc_buffer b1) (loc_buffer b2))) [SMTPatOr [ [SMTPat (B.includes b1 b2)]; [SMTPat (loc_includes(loc_buffer b1) (loc_buffer b2))] ]]
val loc_includes_buffer (#t: Type) (b1 b2: B.buffer t) : Lemma (requires (b1 `B.includes` b2)) (ensures (loc_includes (loc_buffer b1) (loc_buffer b2))) [SMTPatOr [ [SMTPat (B.includes b1 b2)]; [SMTPat (loc_includes(loc_buffer b1) (loc_buffer b2))] ]]
let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2)
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 92, "end_line": 219, "start_col": 0, "start_line": 218 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b1: FStar.Buffer.buffer t -> b2: FStar.Buffer.buffer t -> FStar.Pervasives.Lemma (requires FStar.Buffer.includes b1 b2) (ensures FStar.Modifies.loc_includes (FStar.Modifies.loc_buffer b1) (FStar.Modifies.loc_buffer b2)) [ SMTPatOr [ [SMTPat (FStar.Buffer.includes b1 b2)]; [ SMTPat (FStar.Modifies.loc_includes (FStar.Modifies.loc_buffer b1) (FStar.Modifies.loc_buffer b2)) ] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Buffer.buffer", "FStar.ModifiesGen.loc_includes_aloc", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.frameOf", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let loc_includes_buffer #t b1 b2 =
MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2)
false
FStar.Modifies.fst
FStar.Modifies.modifies
val modifies (s: loc) (h1 h2: HS.mem) : GTot Type0
val modifies (s: loc) (h1 h2: HS.mem) : GTot Type0
let modifies = MG.modifies
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 26, "end_line": 262, "start_col": 0, "start_line": 262 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> h1: FStar.Monotonic.HyperStack.mem -> h2: FStar.Monotonic.HyperStack.mem -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.ModifiesGen.modifies", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
false
true
let modifies =
MG.modifies
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_addresses_addresses
val loc_includes_addresses_addresses (preserve_liveness1 preserve_liveness2: bool) (r: HS.rid) (s1 s2: Set.set nat) : Lemma (requires ((preserve_liveness1 ==> preserve_liveness2) /\ Set.subset s2 s1)) (ensures (loc_includes (loc_addresses preserve_liveness1 r s1) (loc_addresses preserve_liveness2 r s2)))
val loc_includes_addresses_addresses (preserve_liveness1 preserve_liveness2: bool) (r: HS.rid) (s1 s2: Set.set nat) : Lemma (requires ((preserve_liveness1 ==> preserve_liveness2) /\ Set.subset s2 s1)) (ensures (loc_includes (loc_addresses preserve_liveness1 r s1) (loc_addresses preserve_liveness2 r s2)))
let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 81, "end_line": 238, "start_col": 0, "start_line": 238 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness1: Prims.bool -> preserve_liveness2: Prims.bool -> r: FStar.Monotonic.HyperHeap.rid -> s1: FStar.Set.set Prims.nat -> s2: FStar.Set.set Prims.nat -> FStar.Pervasives.Lemma (requires (preserve_liveness1 ==> preserve_liveness2) /\ FStar.Set.subset s2 s1) (ensures FStar.Modifies.loc_includes (FStar.Modifies.loc_addresses preserve_liveness1 r s1) (FStar.Modifies.loc_addresses preserve_liveness2 r s2))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_addresses_addresses", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_includes_addresses_addresses =
MG.loc_includes_addresses_addresses #_ cls
false
FStar.Modifies.fst
FStar.Modifies.loc_includes_region_union_l
val loc_includes_region_union_l (preserve_liveness: bool) (l: loc) (s1 s2: Set.set HS.rid) : Lemma (requires (loc_includes l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1))))) (ensures (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2))) [SMTPat (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2))]
val loc_includes_region_union_l (preserve_liveness: bool) (l: loc) (s1 s2: Set.set HS.rid) : Lemma (requires (loc_includes l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1))))) (ensures (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2))) [SMTPat (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2))]
let loc_includes_region_union_l = MG.loc_includes_region_union_l
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 64, "end_line": 236, "start_col": 0, "start_line": 236 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness: Prims.bool -> l: FStar.Modifies.loc -> s1: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> s2: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_includes l (FStar.Modifies.loc_regions preserve_liveness (FStar.Set.intersect s2 (FStar.Set.complement s1)))) (ensures FStar.Modifies.loc_includes (FStar.Modifies.loc_union (FStar.Modifies.loc_regions preserve_liveness s1) l) (FStar.Modifies.loc_regions preserve_liveness s2)) [ SMTPat (FStar.Modifies.loc_includes (FStar.Modifies.loc_union (FStar.Modifies.loc_regions preserve_liveness s1) l) (FStar.Modifies.loc_regions preserve_liveness s2)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_region_union_l", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_includes_region_union_l =
MG.loc_includes_region_union_l
false
FStar.Modifies.fst
FStar.Modifies.loc_disjoint_sym
val loc_disjoint_sym (s1 s2: loc) : Lemma (requires (loc_disjoint s1 s2)) (ensures (loc_disjoint s2 s1))
val loc_disjoint_sym (s1 s2: loc) : Lemma (requires (loc_disjoint s1 s2)) (ensures (loc_disjoint s2 s1))
let loc_disjoint_sym = MG.loc_disjoint_sym
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 42, "end_line": 242, "start_col": 0, "start_line": 242 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_disjoint s1 s2) (ensures FStar.Modifies.loc_disjoint s2 s1)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_disjoint_sym", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_disjoint_sym =
MG.loc_disjoint_sym
false
FStar.Modifies.fst
FStar.Modifies.region_liveness_insensitive_locs
val region_liveness_insensitive_locs: loc
val region_liveness_insensitive_locs: loc
let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 76, "end_line": 275, "start_col": 0, "start_line": 275 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.Modifies.loc
Prims.Tot
[ "total" ]
[]
[ "FStar.ModifiesGen.region_liveness_insensitive_locs", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
true
false
let region_liveness_insensitive_locs =
MG.region_liveness_insensitive_locs _
false
FStar.Modifies.fst
FStar.Modifies.address_liveness_insensitive_locs
val address_liveness_insensitive_locs: loc
val address_liveness_insensitive_locs: loc
let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 78, "end_line": 273, "start_col": 0, "start_line": 273 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.Modifies.loc
Prims.Tot
[ "total" ]
[]
[ "FStar.ModifiesGen.address_liveness_insensitive_locs", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
false
true
false
let address_liveness_insensitive_locs =
MG.address_liveness_insensitive_locs _
false
FStar.Modifies.fst
FStar.Modifies.loc_disjoint_union_r
val loc_disjoint_union_r (s s1 s2: loc) : Lemma (requires (loc_disjoint s s1 /\ loc_disjoint s s2)) (ensures (loc_disjoint s (loc_union s1 s2))) [SMTPat (loc_disjoint s (loc_union s1 s2))]
val loc_disjoint_union_r (s s1 s2: loc) : Lemma (requires (loc_disjoint s s1 /\ loc_disjoint s s2)) (ensures (loc_disjoint s (loc_union s1 s2))) [SMTPat (loc_disjoint s (loc_union s1 s2))]
let loc_disjoint_union_r = MG.loc_disjoint_union_r
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 50, "end_line": 246, "start_col": 0, "start_line": 246 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> s1: FStar.Modifies.loc -> s2: FStar.Modifies.loc -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_disjoint s s1 /\ FStar.Modifies.loc_disjoint s s2) (ensures FStar.Modifies.loc_disjoint s (FStar.Modifies.loc_union s1 s2)) [SMTPat (FStar.Modifies.loc_disjoint s (FStar.Modifies.loc_union s1 s2))]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_disjoint_union_r", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_disjoint_union_r =
MG.loc_disjoint_union_r
false
FStar.Modifies.fst
FStar.Modifies.loc_disjoint_addresses
val loc_disjoint_addresses (preserve_liveness1 preserve_liveness2: bool) (r1 r2: HS.rid) (n1 n2: Set.set nat) : Lemma (requires (r1 <> r2 \/ Set.subset (Set.intersect n1 n2) Set.empty)) (ensures (loc_disjoint (loc_addresses preserve_liveness1 r1 n1) (loc_addresses preserve_liveness2 r2 n2))) [SMTPat (loc_disjoint (loc_addresses preserve_liveness1 r1 n1) (loc_addresses preserve_liveness2 r2 n2))]
val loc_disjoint_addresses (preserve_liveness1 preserve_liveness2: bool) (r1 r2: HS.rid) (n1 n2: Set.set nat) : Lemma (requires (r1 <> r2 \/ Set.subset (Set.intersect n1 n2) Set.empty)) (ensures (loc_disjoint (loc_addresses preserve_liveness1 r1 n1) (loc_addresses preserve_liveness2 r2 n2))) [SMTPat (loc_disjoint (loc_addresses preserve_liveness1 r1 n1) (loc_addresses preserve_liveness2 r2 n2))]
let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 62, "end_line": 255, "start_col": 0, "start_line": 255 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness1: Prims.bool -> preserve_liveness2: Prims.bool -> r1: FStar.Monotonic.HyperHeap.rid -> r2: FStar.Monotonic.HyperHeap.rid -> n1: FStar.Set.set Prims.nat -> n2: FStar.Set.set Prims.nat -> FStar.Pervasives.Lemma (requires r1 <> r2 \/ FStar.Set.subset (FStar.Set.intersect n1 n2) FStar.Set.empty) (ensures FStar.Modifies.loc_disjoint (FStar.Modifies.loc_addresses preserve_liveness1 r1 n1) (FStar.Modifies.loc_addresses preserve_liveness2 r2 n2)) [ SMTPat (FStar.Modifies.loc_disjoint (FStar.Modifies.loc_addresses preserve_liveness1 r1 n1) (FStar.Modifies.loc_addresses preserve_liveness2 r2 n2)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_disjoint_addresses", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_disjoint_addresses =
MG.loc_disjoint_addresses #_ #cls
false
FStar.Modifies.fst
FStar.Modifies.loc_disjoint_includes
val loc_disjoint_includes (p1 p2 p1' p2' : loc) : Lemma (requires (loc_includes p1 p1' /\ loc_includes p2 p2' /\ loc_disjoint p1 p2)) (ensures (loc_disjoint p1' p2')) [SMTPatOr [ [SMTPat (loc_disjoint p1 p2); SMTPat (loc_disjoint p1' p2')]; [SMTPat (loc_includes p1 p1'); SMTPat (loc_includes p2 p2')]; ]]
val loc_disjoint_includes (p1 p2 p1' p2' : loc) : Lemma (requires (loc_includes p1 p1' /\ loc_includes p2 p2' /\ loc_disjoint p1 p2)) (ensures (loc_disjoint p1' p2')) [SMTPatOr [ [SMTPat (loc_disjoint p1 p2); SMTPat (loc_disjoint p1' p2')]; [SMTPat (loc_includes p1 p1'); SMTPat (loc_includes p2 p2')]; ]]
let loc_disjoint_includes = MG.loc_disjoint_includes
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 52, "end_line": 248, "start_col": 0, "start_line": 248 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p1: FStar.Modifies.loc -> p2: FStar.Modifies.loc -> p1': FStar.Modifies.loc -> p2': FStar.Modifies.loc -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_includes p1 p1' /\ FStar.Modifies.loc_includes p2 p2' /\ FStar.Modifies.loc_disjoint p1 p2) (ensures FStar.Modifies.loc_disjoint p1' p2') [ SMTPatOr [ [ SMTPat (FStar.Modifies.loc_disjoint p1 p2); SMTPat (FStar.Modifies.loc_disjoint p1' p2') ]; [ SMTPat (FStar.Modifies.loc_includes p1 p1'); SMTPat (FStar.Modifies.loc_includes p2 p2') ] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_disjoint_includes", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_disjoint_includes =
MG.loc_disjoint_includes
false
FStar.Modifies.fst
FStar.Modifies.loc_disjoint_buffer
val loc_disjoint_buffer (#t1 #t2: Type) (b1: B.buffer t1) (b2: B.buffer t2) : Lemma (requires (B.disjoint b1 b2)) (ensures (loc_disjoint (loc_buffer b1) (loc_buffer b2))) [SMTPatOr [ [SMTPat (B.disjoint b1 b2)]; [SMTPat (loc_disjoint (loc_buffer b1) (loc_buffer b2))]; ]]
val loc_disjoint_buffer (#t1 #t2: Type) (b1: B.buffer t1) (b2: B.buffer t2) : Lemma (requires (B.disjoint b1 b2)) (ensures (loc_disjoint (loc_buffer b1) (loc_buffer b2))) [SMTPatOr [ [SMTPat (B.disjoint b1 b2)]; [SMTPat (loc_disjoint (loc_buffer b1) (loc_buffer b2))]; ]]
let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2)
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 130, "end_line": 251, "start_col": 0, "start_line": 250 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b1: FStar.Buffer.buffer t1 -> b2: FStar.Buffer.buffer t2 -> FStar.Pervasives.Lemma (requires FStar.Buffer.disjoint b1 b2) (ensures FStar.Modifies.loc_disjoint (FStar.Modifies.loc_buffer b1) (FStar.Modifies.loc_buffer b2)) [ SMTPatOr [ [SMTPat (FStar.Buffer.disjoint b1 b2)]; [ SMTPat (FStar.Modifies.loc_disjoint (FStar.Modifies.loc_buffer b1) (FStar.Modifies.loc_buffer b2)) ] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Buffer.buffer", "FStar.ModifiesGen.loc_disjoint_aloc_intro", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.frameOf", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let loc_disjoint_buffer #t1 #t2 b1 b2 =
MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2)
false
FStar.Modifies.fst
FStar.Modifies.loc_disjoint_none_r
val loc_disjoint_none_r (s: loc) : Lemma (ensures (loc_disjoint s loc_none)) [SMTPat (loc_disjoint s loc_none)]
val loc_disjoint_none_r (s: loc) : Lemma (ensures (loc_disjoint s loc_none)) [SMTPat (loc_disjoint s loc_none)]
let loc_disjoint_none_r = MG.loc_disjoint_none_r
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 48, "end_line": 244, "start_col": 0, "start_line": 244 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_disjoint s FStar.Modifies.loc_none) [SMTPat (FStar.Modifies.loc_disjoint s FStar.Modifies.loc_none)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_disjoint_none_r", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_disjoint_none_r =
MG.loc_disjoint_none_r
false
FStar.Modifies.fst
FStar.Modifies.address_liveness_insensitive_buffer
val address_liveness_insensitive_buffer (#t: Type) (b: B.buffer t) : Lemma (address_liveness_insensitive_locs `loc_includes` (loc_buffer b)) [SMTPat (address_liveness_insensitive_locs `loc_includes` (loc_buffer b))]
val address_liveness_insensitive_buffer (#t: Type) (b: B.buffer t) : Lemma (address_liveness_insensitive_locs `loc_includes` (loc_buffer b)) [SMTPat (address_liveness_insensitive_locs `loc_includes` (loc_buffer b))]
let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 108, "end_line": 278, "start_col": 0, "start_line": 277 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: FStar.Buffer.buffer t -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_includes FStar.Modifies.address_liveness_insensitive_locs (FStar.Modifies.loc_buffer b)) [ SMTPat (FStar.Modifies.loc_includes FStar.Modifies.address_liveness_insensitive_locs (FStar.Modifies.loc_buffer b)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Buffer.buffer", "FStar.ModifiesGen.loc_includes_address_liveness_insensitive_locs_aloc", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.frameOf", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let address_liveness_insensitive_buffer #t b =
MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
false
FStar.Modifies.fst
FStar.Modifies.loc_disjoint_regions
val loc_disjoint_regions (preserve_liveness1 preserve_liveness2: bool) (rs1 rs2: Set.set HS.rid) : Lemma (requires (Set.subset (Set.intersect rs1 rs2) Set.empty)) (ensures (loc_disjoint (loc_regions preserve_liveness1 rs1) (loc_regions preserve_liveness2 rs2))) [SMTPat (loc_disjoint (loc_regions preserve_liveness1 rs1) (loc_regions preserve_liveness2 rs2))]
val loc_disjoint_regions (preserve_liveness1 preserve_liveness2: bool) (rs1 rs2: Set.set HS.rid) : Lemma (requires (Set.subset (Set.intersect rs1 rs2) Set.empty)) (ensures (loc_disjoint (loc_regions preserve_liveness1 rs1) (loc_regions preserve_liveness2 rs2))) [SMTPat (loc_disjoint (loc_regions preserve_liveness1 rs1) (loc_regions preserve_liveness2 rs2))]
let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 58, "end_line": 260, "start_col": 0, "start_line": 260 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness1: Prims.bool -> preserve_liveness2: Prims.bool -> rs1: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> rs2: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> FStar.Pervasives.Lemma (requires FStar.Set.subset (FStar.Set.intersect rs1 rs2) FStar.Set.empty) (ensures FStar.Modifies.loc_disjoint (FStar.Modifies.loc_regions preserve_liveness1 rs1) (FStar.Modifies.loc_regions preserve_liveness2 rs2)) [ SMTPat (FStar.Modifies.loc_disjoint (FStar.Modifies.loc_regions preserve_liveness1 rs1) (FStar.Modifies.loc_regions preserve_liveness2 rs2)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_disjoint_regions", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let loc_disjoint_regions =
MG.loc_disjoint_regions #_ #cls
false
FStar.Modifies.fst
FStar.Modifies.modifies_refl
val modifies_refl (s: loc) (h: HS.mem) : Lemma (modifies s h h) [SMTPat (modifies s h h)]
val modifies_refl (s: loc) (h: HS.mem) : Lemma (modifies s h h) [SMTPat (modifies s h h)]
let modifies_refl = MG.modifies_refl
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 36, "end_line": 269, "start_col": 0, "start_line": 269 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (ensures FStar.Modifies.modifies s h h) [SMTPat (FStar.Modifies.modifies s h h)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_refl", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_refl =
MG.modifies_refl
false
FStar.Modifies.fst
FStar.Modifies.region_liveness_insensitive_buffer
val region_liveness_insensitive_buffer (#t: Type) (b: B.buffer t) : Lemma (region_liveness_insensitive_locs `loc_includes` (loc_buffer b)) [SMTPat (region_liveness_insensitive_locs `loc_includes` (loc_buffer b))]
val region_liveness_insensitive_buffer (#t: Type) (b: B.buffer t) : Lemma (region_liveness_insensitive_locs `loc_includes` (loc_buffer b)) [SMTPat (region_liveness_insensitive_locs `loc_includes` (loc_buffer b))]
let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 113, "end_line": 284, "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 FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: FStar.Buffer.buffer t -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_includes FStar.Modifies.region_liveness_insensitive_locs (FStar.Modifies.loc_buffer b)) [ SMTPat (FStar.Modifies.loc_includes FStar.Modifies.region_liveness_insensitive_locs (FStar.Modifies.loc_buffer b)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Buffer.buffer", "FStar.ModifiesGen.loc_includes_region_liveness_insensitive_locs_loc_of_aloc", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.frameOf", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let region_liveness_insensitive_buffer #t b =
MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
false
FStar.Modifies.fst
FStar.Modifies.modifies_buffer_elim
val modifies_buffer_elim (#t1: Type) (b: B.buffer t1) (p: loc) (h h': HS.mem) : Lemma (requires ( loc_disjoint (loc_buffer b) p /\ B.live h b /\ modifies p h h' )) (ensures ( B.live h' b /\ ( B.as_seq h b == B.as_seq h' b ))) [SMTPatOr [ [ SMTPat (modifies p h h'); SMTPat (B.as_seq h b) ] ; [ SMTPat (modifies p h h'); SMTPat (B.live h b) ]; [ SMTPat (modifies p h h'); SMTPat (B.as_seq h' b) ] ; [ SMTPat (modifies p h h'); SMTPat (B.live h' b) ] ] ]
val modifies_buffer_elim (#t1: Type) (b: B.buffer t1) (p: loc) (h h': HS.mem) : Lemma (requires ( loc_disjoint (loc_buffer b) p /\ B.live h b /\ modifies p h h' )) (ensures ( B.live h' b /\ ( B.as_seq h b == B.as_seq h' b ))) [SMTPatOr [ [ SMTPat (modifies p h h'); SMTPat (B.as_seq h b) ] ; [ SMTPat (modifies p h h'); SMTPat (B.live h b) ]; [ SMTPat (modifies p h h'); SMTPat (B.as_seq h' b) ] ; [ SMTPat (modifies p h h'); SMTPat (B.live h' b) ] ] ]
let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h'
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 82, "end_line": 267, "start_col": 0, "start_line": 266 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: FStar.Buffer.buffer t1 -> p: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_disjoint (FStar.Modifies.loc_buffer b) p /\ FStar.Buffer.live h b /\ FStar.Modifies.modifies p h h') (ensures FStar.Buffer.live h' b /\ FStar.Buffer.as_seq h b == FStar.Buffer.as_seq h' b) [ SMTPatOr [ [SMTPat (FStar.Modifies.modifies p h h'); SMTPat (FStar.Buffer.as_seq h b)]; [SMTPat (FStar.Modifies.modifies p h h'); SMTPat (FStar.Buffer.live h b)]; [SMTPat (FStar.Modifies.modifies p h h'); SMTPat (FStar.Buffer.as_seq h' b)]; [SMTPat (FStar.Modifies.modifies p h h'); SMTPat (FStar.Buffer.live h' b)] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Buffer.buffer", "FStar.Modifies.loc", "FStar.Monotonic.HyperStack.mem", "FStar.ModifiesGen.modifies_aloc_elim", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.frameOf", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let modifies_buffer_elim #t1 b p h h' =
MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h'
false
FStar.Modifies.fst
FStar.Modifies.modifies_mreference_elim
val modifies_mreference_elim (#t: Type) (#pre: Preorder.preorder t) (b: HS.mreference t pre) (p: loc) (h h': HS.mem) : Lemma (requires ( loc_disjoint (loc_mreference b) p /\ HS.contains h b /\ modifies p h h' )) (ensures ( HS.contains h' b /\ HS.sel h b == HS.sel h' b )) [SMTPatOr [ [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ; [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ]; [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ; [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ] ] ]
val modifies_mreference_elim (#t: Type) (#pre: Preorder.preorder t) (b: HS.mreference t pre) (p: loc) (h h': HS.mem) : Lemma (requires ( loc_disjoint (loc_mreference b) p /\ HS.contains h b /\ modifies p h h' )) (ensures ( HS.contains h' b /\ HS.sel h b == HS.sel h' b )) [SMTPatOr [ [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ; [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ]; [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ; [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ] ] ]
let modifies_mreference_elim = MG.modifies_mreference_elim
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 58, "end_line": 264, "start_col": 0, "start_line": 264 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: FStar.Monotonic.HyperStack.mreference t pre -> p: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Modifies.loc_disjoint (FStar.Modifies.loc_mreference b) p /\ FStar.Monotonic.HyperStack.contains h b /\ FStar.Modifies.modifies p h h') (ensures FStar.Monotonic.HyperStack.contains h' b /\ FStar.Monotonic.HyperStack.sel h b == FStar.Monotonic.HyperStack.sel h' b) [ SMTPatOr [ [SMTPat (FStar.Modifies.modifies p h h'); SMTPat (FStar.Monotonic.HyperStack.sel h b)]; [ SMTPat (FStar.Modifies.modifies p h h'); SMTPat (FStar.Monotonic.HyperStack.contains h b) ]; [SMTPat (FStar.Modifies.modifies p h h'); SMTPat (FStar.Monotonic.HyperStack.sel h' b)]; [ SMTPat (FStar.Modifies.modifies p h h'); SMTPat (FStar.Monotonic.HyperStack.contains h' b) ] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_mreference_elim", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_mreference_elim =
MG.modifies_mreference_elim
false
FStar.Modifies.fst
FStar.Modifies.loc_disjoint_buffer_addresses
val loc_disjoint_buffer_addresses (#t: Type) (p: B.buffer t) (preserve_liveness: bool) (r: HS.rid) (n: Set.set nat) : Lemma (requires (r <> B.frameOf p \/ (~ (Set.mem (B.as_addr p) n)))) (ensures (loc_disjoint (loc_buffer p) (loc_addresses preserve_liveness r n))) [SMTPat (loc_disjoint (loc_buffer p) (loc_addresses preserve_liveness r n))]
val loc_disjoint_buffer_addresses (#t: Type) (p: B.buffer t) (preserve_liveness: bool) (r: HS.rid) (n: Set.set nat) : Lemma (requires (r <> B.frameOf p \/ (~ (Set.mem (B.as_addr p) n)))) (ensures (loc_disjoint (loc_buffer p) (loc_addresses preserve_liveness r n))) [SMTPat (loc_disjoint (loc_buffer p) (loc_addresses preserve_liveness r n))]
let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 112, "end_line": 258, "start_col": 0, "start_line": 257 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: FStar.Buffer.buffer t -> preserve_liveness: Prims.bool -> r: FStar.Monotonic.HyperHeap.rid -> n: FStar.Set.set Prims.nat -> FStar.Pervasives.Lemma (requires r <> FStar.Buffer.frameOf p \/ ~(FStar.Set.mem (FStar.Buffer.as_addr p) n)) (ensures FStar.Modifies.loc_disjoint (FStar.Modifies.loc_buffer p) (FStar.Modifies.loc_addresses preserve_liveness r n)) [ SMTPat (FStar.Modifies.loc_disjoint (FStar.Modifies.loc_buffer p) (FStar.Modifies.loc_addresses preserve_liveness r n)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Buffer.buffer", "Prims.bool", "FStar.Monotonic.HyperHeap.rid", "FStar.Set.set", "Prims.nat", "FStar.ModifiesGen.loc_disjoint_aloc_addresses_intro", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.frameOf", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let loc_disjoint_buffer_addresses #t p preserve_liveness r n =
MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n
false
FStar.Modifies.fst
FStar.Modifies.modifies_loc_includes
val modifies_loc_includes (s1: loc) (h h': HS.mem) (s2: loc) : Lemma (requires (modifies s2 h h' /\ loc_includes s1 s2)) (ensures (modifies s1 h h')) [SMTPatOr [ [SMTPat (modifies s1 h h'); SMTPat (modifies s2 h h')]; [SMTPat (modifies s1 h h'); SMTPat (loc_includes s1 s2)]; [SMTPat (modifies s2 h h'); SMTPat (loc_includes s1 s2)]; ]]
val modifies_loc_includes (s1: loc) (h h': HS.mem) (s2: loc) : Lemma (requires (modifies s2 h h' /\ loc_includes s1 s2)) (ensures (modifies s1 h h')) [SMTPatOr [ [SMTPat (modifies s1 h h'); SMTPat (modifies s2 h h')]; [SMTPat (modifies s1 h h'); SMTPat (loc_includes s1 s2)]; [SMTPat (modifies s2 h h'); SMTPat (loc_includes s1 s2)]; ]]
let modifies_loc_includes = MG.modifies_loc_includes
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 52, "end_line": 271, "start_col": 0, "start_line": 271 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> h': FStar.Monotonic.HyperStack.mem -> s2: FStar.Modifies.loc -> FStar.Pervasives.Lemma (requires FStar.Modifies.modifies s2 h h' /\ FStar.Modifies.loc_includes s1 s2) (ensures FStar.Modifies.modifies s1 h h') [ SMTPatOr [ [SMTPat (FStar.Modifies.modifies s1 h h'); SMTPat (FStar.Modifies.modifies s2 h h')]; [SMTPat (FStar.Modifies.modifies s1 h h'); SMTPat (FStar.Modifies.loc_includes s1 s2)]; [SMTPat (FStar.Modifies.modifies s2 h h'); SMTPat (FStar.Modifies.loc_includes s1 s2)] ] ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_loc_includes", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_loc_includes =
MG.modifies_loc_includes
false
FStar.Modifies.fst
FStar.Modifies.address_liveness_insensitive_addresses
val address_liveness_insensitive_addresses (r: HS.rid) (a: Set.set nat) : Lemma (address_liveness_insensitive_locs `loc_includes` (loc_addresses true r a)) [SMTPat (address_liveness_insensitive_locs `loc_includes` (loc_addresses true r a))]
val address_liveness_insensitive_addresses (r: HS.rid) (a: Set.set nat) : Lemma (address_liveness_insensitive_locs `loc_includes` (loc_addresses true r a)) [SMTPat (address_liveness_insensitive_locs `loc_includes` (loc_addresses true r a))]
let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 65, "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 FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: FStar.Monotonic.HyperHeap.rid -> a: FStar.Set.set Prims.nat -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_includes FStar.Modifies.address_liveness_insensitive_locs (FStar.Modifies.loc_addresses true r a)) [ SMTPat (FStar.Modifies.loc_includes FStar.Modifies.address_liveness_insensitive_locs (FStar.Modifies.loc_addresses true r a)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_address_liveness_insensitive_locs_addresses", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let address_liveness_insensitive_addresses =
MG.loc_includes_address_liveness_insensitive_locs_addresses cls
false
FStar.Modifies.fst
FStar.Modifies.does_not_contain_addr
val does_not_contain_addr (h: HS.mem) (ra: HS.rid * nat) : GTot Type0
val does_not_contain_addr (h: HS.mem) (ra: HS.rid * nat) : GTot Type0
let does_not_contain_addr = MG.does_not_contain_addr
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 52, "end_line": 418, "start_col": 0, "start_line": 418 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls let modifies_salloc_post = MG.modifies_salloc_post #_ #cls let modifies_free = MG.modifies_free #_ #cls let modifies_none_modifies = MG.modifies_none_modifies #_ #cls let modifies_buffer_none_modifies h1 h2 = MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_0_modifies h1 h2 = B.lemma_reveal_modifies_0 h1 h2; MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_1_modifies #a b h1 h2 = B.lemma_reveal_modifies_1 b h1 h2; MG.modifies_intro (loc_buffer b) h1 h2 (fun _ -> ()) (fun t' pre' b' -> MG.loc_disjoint_sym (loc_mreference b') (loc_buffer b); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun t' pre' b' -> ()) (fun r n -> ()) (fun r' a' b' -> MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b) #(B.as_addr b) b' (LocBuffer b) ) let modifies_2_modifies #a1 #a2 b1 b2 h1 h2 = B.lemma_reveal_modifies_2 b1 b2 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2) ) #set-options "--z3rlimit 20" let modifies_3_modifies #a1 #a2 #a3 b1 b2 b3 h1 h2 = B.lemma_reveal_modifies_3 b1 b2 b3 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b3); loc_disjoint_sym (loc_mreference b') (loc_buffer b3); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b3) #(B.as_addr b3) (LocBuffer b3) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b3); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b3) #(B.as_addr b3) b' (LocBuffer b3) ) #reset-options let modifies_buffer_rcreate_post_common #a r init len b h0 h1 = MG.modifies_none_intro #_ #cls h0 h1 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let mreference_live_buffer_unused_in_disjoint #t1 #pre #t2 h b1 b2 = loc_disjoint_includes (loc_freed_mreference b1) (loc_freed_mreference (B.content b2)) (loc_freed_mreference b1) (loc_buffer b2) let buffer_live_mreference_unused_in_disjoint #t1 #t2 #pre h b1 b2 = loc_disjoint_includes (loc_freed_mreference (B.content b1)) (loc_freed_mreference b2) (loc_buffer b1) (loc_freed_mreference b2)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> ra: (FStar.Monotonic.HyperHeap.rid * Prims.nat) -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.ModifiesGen.does_not_contain_addr" ]
[]
false
false
false
false
true
let does_not_contain_addr =
MG.does_not_contain_addr
false
FStar.Modifies.fst
FStar.Modifies.region_liveness_insensitive_address_liveness_insensitive
val region_liveness_insensitive_address_liveness_insensitive: squash (region_liveness_insensitive_locs `loc_includes` address_liveness_insensitive_locs)
val region_liveness_insensitive_address_liveness_insensitive: squash (region_liveness_insensitive_locs `loc_includes` address_liveness_insensitive_locs)
let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 88, "end_line": 293, "start_col": 0, "start_line": 292 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.squash (FStar.Modifies.loc_includes FStar.Modifies.region_liveness_insensitive_locs FStar.Modifies.address_liveness_insensitive_locs)
Prims.Tot
[ "total" ]
[]
[ "FStar.ModifiesGen.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
false
false
true
true
false
let region_liveness_insensitive_address_liveness_insensitive =
MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls
false
FStar.Modifies.fst
FStar.Modifies.modifies_liveness_insensitive_mreference
val modifies_liveness_insensitive_mreference (l1 l2 : loc) (h h' : HS.mem) (#t: Type) (#pre: Preorder.preorder t) (x: HS.mreference t pre) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_mreference x) /\ address_liveness_insensitive_locs `loc_includes` l2 /\ h `HS.contains` x)) (ensures (h' `HS.contains` x))
val modifies_liveness_insensitive_mreference (l1 l2 : loc) (h h' : HS.mem) (#t: Type) (#pre: Preorder.preorder t) (x: HS.mreference t pre) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_mreference x) /\ address_liveness_insensitive_locs `loc_includes` l2 /\ h `HS.contains` x)) (ensures (h' `HS.contains` x))
let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 77, "end_line": 295, "start_col": 0, "start_line": 295 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l1: FStar.Modifies.loc -> l2: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> h': FStar.Monotonic.HyperStack.mem -> x: FStar.Monotonic.HyperStack.mreference t pre -> FStar.Pervasives.Lemma (requires FStar.Modifies.modifies (FStar.Modifies.loc_union l1 l2) h h' /\ FStar.Modifies.loc_disjoint l1 (FStar.Modifies.loc_mreference x) /\ FStar.Modifies.loc_includes FStar.Modifies.address_liveness_insensitive_locs l2 /\ FStar.Monotonic.HyperStack.contains h x) (ensures FStar.Monotonic.HyperStack.contains h' x)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_preserves_liveness", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_liveness_insensitive_mreference =
MG.modifies_preserves_liveness
false
FStar.Modifies.fst
FStar.Modifies.modifies_liveness_insensitive_region_buffer
val modifies_liveness_insensitive_region_buffer (l1 l2 : loc) (h h' : HS.mem) (#t: Type) (x: B.buffer t) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_buffer x) /\ region_liveness_insensitive_locs `loc_includes` l2 /\ HS.live_region h (B.frameOf x))) (ensures (HS.live_region h' (B.frameOf x)))
val modifies_liveness_insensitive_region_buffer (l1 l2 : loc) (h h' : HS.mem) (#t: Type) (x: B.buffer t) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_buffer x) /\ region_liveness_insensitive_locs `loc_includes` l2 /\ HS.live_region h (B.frameOf x))) (ensures (HS.live_region h' (B.frameOf x)))
let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x)
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 99, "end_line": 305, "start_col": 0, "start_line": 304 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l1: FStar.Modifies.loc -> l2: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> h': FStar.Monotonic.HyperStack.mem -> x: FStar.Buffer.buffer t -> FStar.Pervasives.Lemma (requires FStar.Modifies.modifies (FStar.Modifies.loc_union l1 l2) h h' /\ FStar.Modifies.loc_disjoint l1 (FStar.Modifies.loc_buffer x) /\ FStar.Modifies.loc_includes FStar.Modifies.region_liveness_insensitive_locs l2 /\ FStar.Monotonic.HyperStack.live_region h (FStar.Buffer.frameOf x)) (ensures FStar.Monotonic.HyperStack.live_region h' (FStar.Buffer.frameOf x))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Modifies.loc", "FStar.Monotonic.HyperStack.mem", "FStar.Buffer.buffer", "FStar.ModifiesGen.modifies_preserves_region_liveness_aloc", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.frameOf", "FStar.Buffer.as_addr", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x =
MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x)
false
FStar.Modifies.fst
FStar.Modifies.cloc_aloc
val cloc_aloc : HS.rid -> nat -> Tot (Type u#1)
val cloc_aloc : HS.rid -> nat -> Tot (Type u#1)
let cloc_aloc = aloc
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 20, "end_line": 435, "start_col": 0, "start_line": 435 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls let modifies_salloc_post = MG.modifies_salloc_post #_ #cls let modifies_free = MG.modifies_free #_ #cls let modifies_none_modifies = MG.modifies_none_modifies #_ #cls let modifies_buffer_none_modifies h1 h2 = MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_0_modifies h1 h2 = B.lemma_reveal_modifies_0 h1 h2; MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_1_modifies #a b h1 h2 = B.lemma_reveal_modifies_1 b h1 h2; MG.modifies_intro (loc_buffer b) h1 h2 (fun _ -> ()) (fun t' pre' b' -> MG.loc_disjoint_sym (loc_mreference b') (loc_buffer b); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun t' pre' b' -> ()) (fun r n -> ()) (fun r' a' b' -> MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b) #(B.as_addr b) b' (LocBuffer b) ) let modifies_2_modifies #a1 #a2 b1 b2 h1 h2 = B.lemma_reveal_modifies_2 b1 b2 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2) ) #set-options "--z3rlimit 20" let modifies_3_modifies #a1 #a2 #a3 b1 b2 b3 h1 h2 = B.lemma_reveal_modifies_3 b1 b2 b3 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b3); loc_disjoint_sym (loc_mreference b') (loc_buffer b3); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b3) #(B.as_addr b3) (LocBuffer b3) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b3); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b3) #(B.as_addr b3) b' (LocBuffer b3) ) #reset-options let modifies_buffer_rcreate_post_common #a r init len b h0 h1 = MG.modifies_none_intro #_ #cls h0 h1 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let mreference_live_buffer_unused_in_disjoint #t1 #pre #t2 h b1 b2 = loc_disjoint_includes (loc_freed_mreference b1) (loc_freed_mreference (B.content b2)) (loc_freed_mreference b1) (loc_buffer b2) let buffer_live_mreference_unused_in_disjoint #t1 #t2 #pre h b1 b2 = loc_disjoint_includes (loc_freed_mreference (B.content b1)) (loc_freed_mreference b2) (loc_buffer b1) (loc_freed_mreference b2) let does_not_contain_addr = MG.does_not_contain_addr let not_live_region_does_not_contain_addr = MG.not_live_region_does_not_contain_addr let unused_in_does_not_contain_addr = MG.unused_in_does_not_contain_addr let addr_unused_in_does_not_contain_addr = MG.addr_unused_in_does_not_contain_addr let free_does_not_contain_addr = MG.free_does_not_contain_addr let does_not_contain_addr_elim = MG.does_not_contain_addr_elim let modifies_only_live_addresses = MG.modifies_only_live_addresses (* Type class instance *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: FStar.Monotonic.HyperHeap.rid -> _: Prims.nat -> Type
Prims.Tot
[ "total" ]
[]
[ "FStar.Modifies.aloc" ]
[]
false
false
false
true
true
let cloc_aloc =
aloc
false
FStar.Modifies.fst
FStar.Modifies.no_upd_fresh_region
val no_upd_fresh_region: r:HS.rid -> l:loc -> h0:HS.mem -> h1:HS.mem -> Lemma (requires (HS.fresh_region r h0 h1 /\ modifies (loc_union (loc_all_regions_from false r) l) h0 h1)) (ensures (modifies l h0 h1)) [SMTPat (HS.fresh_region r h0 h1); SMTPat (modifies l h0 h1)]
val no_upd_fresh_region: r:HS.rid -> l:loc -> h0:HS.mem -> h1:HS.mem -> Lemma (requires (HS.fresh_region r h0 h1 /\ modifies (loc_union (loc_all_regions_from false r) l) h0 h1)) (ensures (modifies l h0 h1)) [SMTPat (HS.fresh_region r h0 h1); SMTPat (modifies l h0 h1)]
let no_upd_fresh_region = MG.no_upd_fresh_region
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 48, "end_line": 312, "start_col": 0, "start_line": 312 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: FStar.Monotonic.HyperHeap.rid -> l: FStar.Modifies.loc -> h0: FStar.Monotonic.HyperStack.mem -> h1: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Monotonic.HyperStack.fresh_region r h0 h1 /\ FStar.Modifies.modifies (FStar.Modifies.loc_union (FStar.Modifies.loc_all_regions_from false r) l) h0 h1) (ensures FStar.Modifies.modifies l h0 h1) [ SMTPat (FStar.Monotonic.HyperStack.fresh_region r h0 h1); SMTPat (FStar.Modifies.modifies l h0 h1) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.no_upd_fresh_region", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let no_upd_fresh_region =
MG.no_upd_fresh_region
false
FStar.Modifies.fst
FStar.Modifies.modifies_trans
val modifies_trans (s12: loc) (h1 h2: HS.mem) (s23: loc) (h3: HS.mem) : Lemma (requires (modifies s12 h1 h2 /\ modifies s23 h2 h3)) (ensures (modifies (loc_union s12 s23) h1 h3)) [SMTPat (modifies s12 h1 h2); SMTPat (modifies s23 h2 h3)]
val modifies_trans (s12: loc) (h1 h2: HS.mem) (s23: loc) (h3: HS.mem) : Lemma (requires (modifies s12 h1 h2 /\ modifies s23 h2 h3)) (ensures (modifies (loc_union s12 s23) h1 h3)) [SMTPat (modifies s12 h1 h2); SMTPat (modifies s23 h2 h3)]
let modifies_trans = MG.modifies_trans
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 308, "start_col": 0, "start_line": 308 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s12: FStar.Modifies.loc -> h1: FStar.Monotonic.HyperStack.mem -> h2: FStar.Monotonic.HyperStack.mem -> s23: FStar.Modifies.loc -> h3: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Modifies.modifies s12 h1 h2 /\ FStar.Modifies.modifies s23 h2 h3) (ensures FStar.Modifies.modifies (FStar.Modifies.loc_union s12 s23) h1 h3) [SMTPat (FStar.Modifies.modifies s12 h1 h2); SMTPat (FStar.Modifies.modifies s23 h2 h3)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_trans", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_trans =
MG.modifies_trans
false
FStar.Modifies.fst
FStar.Modifies.modifies_liveness_insensitive_buffer
val modifies_liveness_insensitive_buffer (l1 l2 : loc) (h h' : HS.mem) (#t: Type) (x: B.buffer t) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_buffer x) /\ address_liveness_insensitive_locs `loc_includes` l2 /\ B.live h x)) (ensures (B.live h' x))
val modifies_liveness_insensitive_buffer (l1 l2 : loc) (h h' : HS.mem) (#t: Type) (x: B.buffer t) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_buffer x) /\ address_liveness_insensitive_locs `loc_includes` l2 /\ B.live h x)) (ensures (B.live h' x))
let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x)
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 78, "end_line": 298, "start_col": 0, "start_line": 297 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l1: FStar.Modifies.loc -> l2: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> h': FStar.Monotonic.HyperStack.mem -> x: FStar.Buffer.buffer t -> FStar.Pervasives.Lemma (requires FStar.Modifies.modifies (FStar.Modifies.loc_union l1 l2) h h' /\ FStar.Modifies.loc_disjoint l1 (FStar.Modifies.loc_buffer x) /\ FStar.Modifies.loc_includes FStar.Modifies.address_liveness_insensitive_locs l2 /\ FStar.Buffer.live h x) (ensures FStar.Buffer.live h' x)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Modifies.loc", "FStar.Monotonic.HyperStack.mem", "FStar.Buffer.buffer", "FStar.ModifiesGen.modifies_preserves_liveness_strong", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Buffer.lseq", "FStar.Buffer.max_length", "FStar.Heap.trivial_preorder", "FStar.Buffer.content", "FStar.Modifies.LocBuffer", "Prims.unit" ]
[]
true
false
true
false
false
let modifies_liveness_insensitive_buffer l1 l2 h h' #t x =
MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x)
false
FStar.Modifies.fst
FStar.Modifies.modifies_loc_addresses_intro
val modifies_loc_addresses_intro (r: HS.rid) (a: Set.set nat) (l: loc) (h1 h2: HS.mem) : Lemma (requires ( HS.live_region h2 r /\ modifies (loc_union (loc_region_only false r) l) h1 h2 /\ HS.modifies_ref r a h1 h2 )) (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))
val modifies_loc_addresses_intro (r: HS.rid) (a: Set.set nat) (l: loc) (h1 h2: HS.mem) : Lemma (requires ( HS.live_region h2 r /\ modifies (loc_union (loc_region_only false r) l) h1 h2 /\ HS.modifies_ref r a h1 h2 )) (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))
let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 66, "end_line": 318, "start_col": 0, "start_line": 318 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: FStar.Monotonic.HyperHeap.rid -> a: FStar.Set.set Prims.nat -> l: FStar.Modifies.loc -> h1: FStar.Monotonic.HyperStack.mem -> h2: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Monotonic.HyperStack.live_region h2 r /\ FStar.Modifies.modifies (FStar.Modifies.loc_union (FStar.Modifies.loc_region_only false r) l ) h1 h2 /\ FStar.Monotonic.HyperStack.modifies_ref r a h1 h2) (ensures FStar.Modifies.modifies (FStar.Modifies.loc_union (FStar.Modifies.loc_addresses true r a) l) h1 h2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_loc_addresses_intro", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_loc_addresses_intro =
MG.modifies_loc_addresses_intro
false
FStar.Modifies.fst
FStar.Modifies.modifies_none_modifies
val modifies_none_modifies (h1 h2: HS.mem) : Lemma (requires (HST.modifies_none h1 h2)) (ensures (modifies loc_none h1 h2))
val modifies_none_modifies (h1 h2: HS.mem) : Lemma (requires (HST.modifies_none h1 h2)) (ensures (modifies loc_none h1 h2))
let modifies_none_modifies = MG.modifies_none_modifies #_ #cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 62, "end_line": 326, "start_col": 0, "start_line": 326 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls let modifies_salloc_post = MG.modifies_salloc_post #_ #cls let modifies_free = MG.modifies_free #_ #cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h1: FStar.Monotonic.HyperStack.mem -> h2: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.HyperStack.ST.modifies_none h1 h2) (ensures FStar.Modifies.modifies FStar.Modifies.loc_none h1 h2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_none_modifies", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_none_modifies =
MG.modifies_none_modifies #_ #cls
false
FStar.Modifies.fst
FStar.Modifies.modifies_loc_regions_intro
val modifies_loc_regions_intro (rs: Set.set HS.rid) (h1 h2: HS.mem) : Lemma (requires (HS.modifies rs h1 h2)) (ensures (modifies (loc_regions true rs) h1 h2))
val modifies_loc_regions_intro (rs: Set.set HS.rid) (h1 h2: HS.mem) : Lemma (requires (HS.modifies rs h1 h2)) (ensures (modifies (loc_regions true rs) h1 h2))
let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 70, "end_line": 316, "start_col": 0, "start_line": 316 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
rs: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> h1: FStar.Monotonic.HyperStack.mem -> h2: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Monotonic.HyperStack.modifies rs h1 h2) (ensures FStar.Modifies.modifies (FStar.Modifies.loc_regions true rs) h1 h2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_loc_regions_intro", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_loc_regions_intro =
MG.modifies_loc_regions_intro #_ #cls
false
FStar.Modifies.fst
FStar.Modifies.modifies_only_live_regions
val modifies_only_live_regions (rs: Set.set HS.rid) (l: loc) (h h' : HS.mem) : Lemma (requires ( modifies (loc_union (loc_regions false rs) l) h h' /\ (forall r . Set.mem r rs ==> (~ (HS.live_region h r))) )) (ensures (modifies l h h'))
val modifies_only_live_regions (rs: Set.set HS.rid) (l: loc) (h h' : HS.mem) : Lemma (requires ( modifies (loc_union (loc_regions false rs) l) h h' /\ (forall r . Set.mem r rs ==> (~ (HS.live_region h r))) )) (ensures (modifies l h h'))
let modifies_only_live_regions = MG.modifies_only_live_regions
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 62, "end_line": 310, "start_col": 0, "start_line": 310 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
rs: FStar.Set.set FStar.Monotonic.HyperHeap.rid -> l: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Modifies.modifies (FStar.Modifies.loc_union (FStar.Modifies.loc_regions false rs) l) h h' /\ (forall (r: FStar.Monotonic.HyperHeap.rid). FStar.Set.mem r rs ==> ~(FStar.Monotonic.HyperStack.live_region h r))) (ensures FStar.Modifies.modifies l h h')
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_only_live_regions", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_only_live_regions =
MG.modifies_only_live_regions
false
FStar.Modifies.fst
FStar.Modifies.modifies_liveness_insensitive_region_mreference
val modifies_liveness_insensitive_region_mreference (l1 l2 : loc) (h h' : HS.mem) (#t: Type) (#pre: Preorder.preorder t) (x: HS.mreference t pre) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_mreference x) /\ region_liveness_insensitive_locs `loc_includes` l2 /\ HS.live_region h (HS.frameOf x))) (ensures (HS.live_region h' (HS.frameOf x)))
val modifies_liveness_insensitive_region_mreference (l1 l2 : loc) (h h' : HS.mem) (#t: Type) (#pre: Preorder.preorder t) (x: HS.mreference t pre) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_mreference x) /\ region_liveness_insensitive_locs `loc_includes` l2 /\ HS.live_region h (HS.frameOf x))) (ensures (HS.live_region h' (HS.frameOf x)))
let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 101, "end_line": 302, "start_col": 0, "start_line": 302 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l1: FStar.Modifies.loc -> l2: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> h': FStar.Monotonic.HyperStack.mem -> x: FStar.Monotonic.HyperStack.mreference t pre -> FStar.Pervasives.Lemma (requires FStar.Modifies.modifies (FStar.Modifies.loc_union l1 l2) h h' /\ FStar.Modifies.loc_disjoint l1 (FStar.Modifies.loc_mreference x) /\ FStar.Modifies.loc_includes FStar.Modifies.region_liveness_insensitive_locs l2 /\ FStar.Monotonic.HyperStack.live_region h (FStar.Monotonic.HyperStack.frameOf x)) (ensures FStar.Monotonic.HyperStack.live_region h' (FStar.Monotonic.HyperStack.frameOf x))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_preserves_region_liveness_reference", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_liveness_insensitive_region_mreference =
MG.modifies_preserves_region_liveness_reference
false
FStar.Modifies.fst
FStar.Modifies.modifies_ralloc_post
val modifies_ralloc_post (#a: Type) (#rel: Preorder.preorder a) (i: HS.rid) (init: a) (h: HS.mem) (x: HST.mreference a rel { HST.is_eternal_region (HS.frameOf x) } ) (h' : HS.mem) : Lemma (requires (HST.ralloc_post i init h x h')) (ensures (modifies loc_none h h'))
val modifies_ralloc_post (#a: Type) (#rel: Preorder.preorder a) (i: HS.rid) (init: a) (h: HS.mem) (x: HST.mreference a rel { HST.is_eternal_region (HS.frameOf x) } ) (h' : HS.mem) : Lemma (requires (HST.ralloc_post i init h x h')) (ensures (modifies loc_none h h'))
let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 58, "end_line": 320, "start_col": 0, "start_line": 320 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
i: FStar.Monotonic.HyperHeap.rid -> init: a -> h: FStar.Monotonic.HyperStack.mem -> x: FStar.HyperStack.ST.mreference a rel {FStar.HyperStack.ST.is_eternal_region (FStar.Monotonic.HyperStack.frameOf x)} -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.HyperStack.ST.ralloc_post i init h x h') (ensures FStar.Modifies.modifies FStar.Modifies.loc_none h h')
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_ralloc_post", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_ralloc_post =
MG.modifies_ralloc_post #_ #cls
false
FStar.Modifies.fst
FStar.Modifies.modifies_fresh_frame_popped
val modifies_fresh_frame_popped (h0 h1: HS.mem) (s: loc) (h2 h3: HS.mem) : Lemma (requires ( HS.fresh_frame h0 h1 /\ modifies (loc_union (loc_all_regions_from false (HS.get_tip h1)) s) h1 h2 /\ (HS.get_tip h2) == (HS.get_tip h1) /\ HS.popped h2 h3 )) (ensures ( modifies s h0 h3 /\ (HS.get_tip h3) == HS.get_tip h0 )) [SMTPat (HS.fresh_frame h0 h1); SMTPat (HS.popped h2 h3); SMTPat (modifies s h0 h3)]
val modifies_fresh_frame_popped (h0 h1: HS.mem) (s: loc) (h2 h3: HS.mem) : Lemma (requires ( HS.fresh_frame h0 h1 /\ modifies (loc_union (loc_all_regions_from false (HS.get_tip h1)) s) h1 h2 /\ (HS.get_tip h2) == (HS.get_tip h1) /\ HS.popped h2 h3 )) (ensures ( modifies s h0 h3 /\ (HS.get_tip h3) == HS.get_tip h0 )) [SMTPat (HS.fresh_frame h0 h1); SMTPat (HS.popped h2 h3); SMTPat (modifies s h0 h3)]
let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 64, "end_line": 314, "start_col": 0, "start_line": 314 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h0: FStar.Monotonic.HyperStack.mem -> h1: FStar.Monotonic.HyperStack.mem -> s: FStar.Modifies.loc -> h2: FStar.Monotonic.HyperStack.mem -> h3: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Monotonic.HyperStack.fresh_frame h0 h1 /\ FStar.Modifies.modifies (FStar.Modifies.loc_union (FStar.Modifies.loc_all_regions_from false (FStar.Monotonic.HyperStack.get_tip h1)) s) h1 h2 /\ FStar.Monotonic.HyperStack.get_tip h2 == FStar.Monotonic.HyperStack.get_tip h1 /\ FStar.Monotonic.HyperStack.popped h2 h3) (ensures FStar.Modifies.modifies s h0 h3 /\ FStar.Monotonic.HyperStack.get_tip h3 == FStar.Monotonic.HyperStack.get_tip h0) [ SMTPat (FStar.Monotonic.HyperStack.fresh_frame h0 h1); SMTPat (FStar.Monotonic.HyperStack.popped h2 h3); SMTPat (FStar.Modifies.modifies s h0 h3) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_fresh_frame_popped", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_fresh_frame_popped =
MG.modifies_fresh_frame_popped
false
FStar.Modifies.fst
FStar.Modifies.cloc_cls
val cloc_cls: MG.cls cloc_aloc
val cloc_cls: MG.cls cloc_aloc
let cloc_cls = cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 18, "end_line": 437, "start_col": 0, "start_line": 437 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls let modifies_salloc_post = MG.modifies_salloc_post #_ #cls let modifies_free = MG.modifies_free #_ #cls let modifies_none_modifies = MG.modifies_none_modifies #_ #cls let modifies_buffer_none_modifies h1 h2 = MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_0_modifies h1 h2 = B.lemma_reveal_modifies_0 h1 h2; MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_1_modifies #a b h1 h2 = B.lemma_reveal_modifies_1 b h1 h2; MG.modifies_intro (loc_buffer b) h1 h2 (fun _ -> ()) (fun t' pre' b' -> MG.loc_disjoint_sym (loc_mreference b') (loc_buffer b); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun t' pre' b' -> ()) (fun r n -> ()) (fun r' a' b' -> MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b) #(B.as_addr b) b' (LocBuffer b) ) let modifies_2_modifies #a1 #a2 b1 b2 h1 h2 = B.lemma_reveal_modifies_2 b1 b2 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2) ) #set-options "--z3rlimit 20" let modifies_3_modifies #a1 #a2 #a3 b1 b2 b3 h1 h2 = B.lemma_reveal_modifies_3 b1 b2 b3 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b3); loc_disjoint_sym (loc_mreference b') (loc_buffer b3); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b3) #(B.as_addr b3) (LocBuffer b3) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b3); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b3) #(B.as_addr b3) b' (LocBuffer b3) ) #reset-options let modifies_buffer_rcreate_post_common #a r init len b h0 h1 = MG.modifies_none_intro #_ #cls h0 h1 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let mreference_live_buffer_unused_in_disjoint #t1 #pre #t2 h b1 b2 = loc_disjoint_includes (loc_freed_mreference b1) (loc_freed_mreference (B.content b2)) (loc_freed_mreference b1) (loc_buffer b2) let buffer_live_mreference_unused_in_disjoint #t1 #t2 #pre h b1 b2 = loc_disjoint_includes (loc_freed_mreference (B.content b1)) (loc_freed_mreference b2) (loc_buffer b1) (loc_freed_mreference b2) let does_not_contain_addr = MG.does_not_contain_addr let not_live_region_does_not_contain_addr = MG.not_live_region_does_not_contain_addr let unused_in_does_not_contain_addr = MG.unused_in_does_not_contain_addr let addr_unused_in_does_not_contain_addr = MG.addr_unused_in_does_not_contain_addr let free_does_not_contain_addr = MG.free_does_not_contain_addr let does_not_contain_addr_elim = MG.does_not_contain_addr_elim let modifies_only_live_addresses = MG.modifies_only_live_addresses (* Type class instance *) let cloc_aloc = aloc
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.ModifiesGen.cls FStar.Modifies.cloc_aloc
Prims.Tot
[ "total" ]
[]
[ "FStar.Modifies.cls" ]
[]
false
false
false
true
false
let cloc_cls =
cls
false
FStar.Modifies.fst
FStar.Modifies.modifies_salloc_post
val modifies_salloc_post (#a: Type) (#rel: Preorder.preorder a) (init: a) (h: HS.mem) (x: HST.mreference a rel { HS.is_stack_region (HS.frameOf x) } ) (h' : HS.mem) : Lemma (requires (HST.salloc_post init h x h')) (ensures (modifies loc_none h h'))
val modifies_salloc_post (#a: Type) (#rel: Preorder.preorder a) (init: a) (h: HS.mem) (x: HST.mreference a rel { HS.is_stack_region (HS.frameOf x) } ) (h' : HS.mem) : Lemma (requires (HST.salloc_post init h x h')) (ensures (modifies loc_none h h'))
let modifies_salloc_post = MG.modifies_salloc_post #_ #cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 58, "end_line": 322, "start_col": 0, "start_line": 322 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
init: a -> h: FStar.Monotonic.HyperStack.mem -> x: FStar.HyperStack.ST.mreference a rel {FStar.Monotonic.HyperStack.is_stack_region (FStar.Monotonic.HyperStack.frameOf x)} -> h': FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.HyperStack.ST.salloc_post init h x h') (ensures FStar.Modifies.modifies FStar.Modifies.loc_none h h')
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_salloc_post", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_salloc_post =
MG.modifies_salloc_post #_ #cls
false
FStar.Modifies.fst
FStar.Modifies.modifies_liveness_insensitive_region
val modifies_liveness_insensitive_region (l1 l2 : loc) (h h' : HS.mem) (x: HS.rid) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_region_only false x) /\ region_liveness_insensitive_locs `loc_includes` l2 /\ HS.live_region h x)) (ensures (HS.live_region h' x))
val modifies_liveness_insensitive_region (l1 l2 : loc) (h h' : HS.mem) (x: HS.rid) : Lemma (requires (modifies (loc_union l1 l2) h h' /\ loc_disjoint l1 (loc_region_only false x) /\ region_liveness_insensitive_locs `loc_includes` l2 /\ HS.live_region h x)) (ensures (HS.live_region h' x))
let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 80, "end_line": 300, "start_col": 0, "start_line": 300 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l1: FStar.Modifies.loc -> l2: FStar.Modifies.loc -> h: FStar.Monotonic.HyperStack.mem -> h': FStar.Monotonic.HyperStack.mem -> x: FStar.Monotonic.HyperHeap.rid -> FStar.Pervasives.Lemma (requires FStar.Modifies.modifies (FStar.Modifies.loc_union l1 l2) h h' /\ FStar.Modifies.loc_disjoint l1 (FStar.Modifies.loc_region_only false x) /\ FStar.Modifies.loc_includes FStar.Modifies.region_liveness_insensitive_locs l2 /\ FStar.Monotonic.HyperStack.live_region h x) (ensures FStar.Monotonic.HyperStack.live_region h' x)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.modifies_preserves_region_liveness", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let modifies_liveness_insensitive_region =
MG.modifies_preserves_region_liveness
false
FStar.Modifies.fst
FStar.Modifies.region_liveness_insensitive_addresses
val region_liveness_insensitive_addresses (preserve_liveness: bool) (r: HS.rid) (a: Set.set nat) : Lemma (region_liveness_insensitive_locs `loc_includes` (loc_addresses preserve_liveness r a)) [SMTPat (region_liveness_insensitive_locs `loc_includes` (loc_addresses preserve_liveness r a))]
val region_liveness_insensitive_addresses (preserve_liveness: bool) (r: HS.rid) (a: Set.set nat) : Lemma (region_liveness_insensitive_locs `loc_includes` (loc_addresses preserve_liveness r a)) [SMTPat (region_liveness_insensitive_locs `loc_includes` (loc_addresses preserve_liveness r a))]
let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 68, "end_line": 287, "start_col": 0, "start_line": 286 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
preserve_liveness: Prims.bool -> r: FStar.Monotonic.HyperHeap.rid -> a: FStar.Set.set Prims.nat -> FStar.Pervasives.Lemma (ensures FStar.Modifies.loc_includes FStar.Modifies.region_liveness_insensitive_locs (FStar.Modifies.loc_addresses preserve_liveness r a)) [ SMTPat (FStar.Modifies.loc_includes FStar.Modifies.region_liveness_insensitive_locs (FStar.Modifies.loc_addresses preserve_liveness r a)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.ModifiesGen.loc_includes_region_liveness_insensitive_locs_loc_addresses", "FStar.Modifies.aloc", "FStar.Modifies.cls" ]
[]
true
false
true
false
false
let region_liveness_insensitive_addresses =
MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls
false
FStar.Modifies.fst
FStar.Modifies.cloc_of_loc
val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)
val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)
let cloc_of_loc l = l
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 21, "end_line": 439, "start_col": 0, "start_line": 439 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls let modifies_salloc_post = MG.modifies_salloc_post #_ #cls let modifies_free = MG.modifies_free #_ #cls let modifies_none_modifies = MG.modifies_none_modifies #_ #cls let modifies_buffer_none_modifies h1 h2 = MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_0_modifies h1 h2 = B.lemma_reveal_modifies_0 h1 h2; MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_1_modifies #a b h1 h2 = B.lemma_reveal_modifies_1 b h1 h2; MG.modifies_intro (loc_buffer b) h1 h2 (fun _ -> ()) (fun t' pre' b' -> MG.loc_disjoint_sym (loc_mreference b') (loc_buffer b); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun t' pre' b' -> ()) (fun r n -> ()) (fun r' a' b' -> MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b) #(B.as_addr b) b' (LocBuffer b) ) let modifies_2_modifies #a1 #a2 b1 b2 h1 h2 = B.lemma_reveal_modifies_2 b1 b2 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2) ) #set-options "--z3rlimit 20" let modifies_3_modifies #a1 #a2 #a3 b1 b2 b3 h1 h2 = B.lemma_reveal_modifies_3 b1 b2 b3 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b3); loc_disjoint_sym (loc_mreference b') (loc_buffer b3); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b3) #(B.as_addr b3) (LocBuffer b3) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b3); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b3) #(B.as_addr b3) b' (LocBuffer b3) ) #reset-options let modifies_buffer_rcreate_post_common #a r init len b h0 h1 = MG.modifies_none_intro #_ #cls h0 h1 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let mreference_live_buffer_unused_in_disjoint #t1 #pre #t2 h b1 b2 = loc_disjoint_includes (loc_freed_mreference b1) (loc_freed_mreference (B.content b2)) (loc_freed_mreference b1) (loc_buffer b2) let buffer_live_mreference_unused_in_disjoint #t1 #t2 #pre h b1 b2 = loc_disjoint_includes (loc_freed_mreference (B.content b1)) (loc_freed_mreference b2) (loc_buffer b1) (loc_freed_mreference b2) let does_not_contain_addr = MG.does_not_contain_addr let not_live_region_does_not_contain_addr = MG.not_live_region_does_not_contain_addr let unused_in_does_not_contain_addr = MG.unused_in_does_not_contain_addr let addr_unused_in_does_not_contain_addr = MG.addr_unused_in_does_not_contain_addr let free_does_not_contain_addr = MG.free_does_not_contain_addr let does_not_contain_addr_elim = MG.does_not_contain_addr_elim let modifies_only_live_addresses = MG.modifies_only_live_addresses (* Type class instance *) let cloc_aloc = aloc let cloc_cls = cls
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: FStar.Modifies.loc -> FStar.ModifiesGen.loc FStar.Modifies.cloc_cls
Prims.Tot
[ "total" ]
[]
[ "FStar.Modifies.loc", "FStar.ModifiesGen.loc", "FStar.Modifies.cloc_aloc", "FStar.Modifies.cloc_cls" ]
[]
false
false
false
true
false
let cloc_of_loc l =
l
false
FStar.Modifies.fst
FStar.Modifies.modifies_0_modifies
val modifies_0_modifies (h1 h2: HS.mem) : Lemma (requires (B.modifies_0 h1 h2)) (ensures (modifies loc_none h1 h2)) [SMTPat (B.modifies_0 h1 h2)]
val modifies_0_modifies (h1 h2: HS.mem) : Lemma (requires (B.modifies_0 h1 h2)) (ensures (modifies loc_none h1 h2)) [SMTPat (B.modifies_0 h1 h2)]
let modifies_0_modifies h1 h2 = B.lemma_reveal_modifies_0 h1 h2; MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ())
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 19, "end_line": 339, "start_col": 0, "start_line": 334 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls let modifies_salloc_post = MG.modifies_salloc_post #_ #cls let modifies_free = MG.modifies_free #_ #cls let modifies_none_modifies = MG.modifies_none_modifies #_ #cls let modifies_buffer_none_modifies h1 h2 = MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h1: FStar.Monotonic.HyperStack.mem -> h2: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Buffer.modifies_0 h1 h2) (ensures FStar.Modifies.modifies FStar.Modifies.loc_none h1 h2) [SMTPat (FStar.Buffer.modifies_0 h1 h2)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Monotonic.HyperStack.mem", "FStar.ModifiesGen.modifies_none_intro", "FStar.Modifies.aloc", "FStar.Modifies.cls", "FStar.Monotonic.HyperHeap.rid", "Prims.unit", "FStar.Preorder.preorder", "FStar.Monotonic.HyperStack.mreference", "Prims.nat", "FStar.Buffer.lemma_reveal_modifies_0" ]
[]
false
false
true
false
false
let modifies_0_modifies h1 h2 =
B.lemma_reveal_modifies_0 h1 h2; MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ())
false
FStar.Modifies.fst
FStar.Modifies.loc_of_cloc
val loc_of_cloc (l: MG.loc cloc_cls) : Tot loc
val loc_of_cloc (l: MG.loc cloc_cls) : Tot loc
let loc_of_cloc l = l
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 21, "end_line": 441, "start_col": 0, "start_line": 441 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls let modifies_salloc_post = MG.modifies_salloc_post #_ #cls let modifies_free = MG.modifies_free #_ #cls let modifies_none_modifies = MG.modifies_none_modifies #_ #cls let modifies_buffer_none_modifies h1 h2 = MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_0_modifies h1 h2 = B.lemma_reveal_modifies_0 h1 h2; MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_1_modifies #a b h1 h2 = B.lemma_reveal_modifies_1 b h1 h2; MG.modifies_intro (loc_buffer b) h1 h2 (fun _ -> ()) (fun t' pre' b' -> MG.loc_disjoint_sym (loc_mreference b') (loc_buffer b); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun t' pre' b' -> ()) (fun r n -> ()) (fun r' a' b' -> MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b) #(B.as_addr b) b' (LocBuffer b) ) let modifies_2_modifies #a1 #a2 b1 b2 h1 h2 = B.lemma_reveal_modifies_2 b1 b2 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2) ) #set-options "--z3rlimit 20" let modifies_3_modifies #a1 #a2 #a3 b1 b2 b3 h1 h2 = B.lemma_reveal_modifies_3 b1 b2 b3 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b3); loc_disjoint_sym (loc_mreference b') (loc_buffer b3); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b3) #(B.as_addr b3) (LocBuffer b3) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b3); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b3) #(B.as_addr b3) b' (LocBuffer b3) ) #reset-options let modifies_buffer_rcreate_post_common #a r init len b h0 h1 = MG.modifies_none_intro #_ #cls h0 h1 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let mreference_live_buffer_unused_in_disjoint #t1 #pre #t2 h b1 b2 = loc_disjoint_includes (loc_freed_mreference b1) (loc_freed_mreference (B.content b2)) (loc_freed_mreference b1) (loc_buffer b2) let buffer_live_mreference_unused_in_disjoint #t1 #t2 #pre h b1 b2 = loc_disjoint_includes (loc_freed_mreference (B.content b1)) (loc_freed_mreference b2) (loc_buffer b1) (loc_freed_mreference b2) let does_not_contain_addr = MG.does_not_contain_addr let not_live_region_does_not_contain_addr = MG.not_live_region_does_not_contain_addr let unused_in_does_not_contain_addr = MG.unused_in_does_not_contain_addr let addr_unused_in_does_not_contain_addr = MG.addr_unused_in_does_not_contain_addr let free_does_not_contain_addr = MG.free_does_not_contain_addr let does_not_contain_addr_elim = MG.does_not_contain_addr_elim let modifies_only_live_addresses = MG.modifies_only_live_addresses (* Type class instance *) let cloc_aloc = aloc let cloc_cls = cls let cloc_of_loc l = l
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: FStar.ModifiesGen.loc FStar.Modifies.cloc_cls -> FStar.Modifies.loc
Prims.Tot
[ "total" ]
[]
[ "FStar.ModifiesGen.loc", "FStar.Modifies.cloc_aloc", "FStar.Modifies.cloc_cls", "FStar.Modifies.loc" ]
[]
false
false
false
true
false
let loc_of_cloc l =
l
false
FStar.Modifies.fst
FStar.Modifies.modifies_buffer_rcreate_post_common
val modifies_buffer_rcreate_post_common (#a: Type) (r: HS.rid) (init: a) (len: FStar.UInt32.t) (b: B.buffer a) (h0 h1: HS.mem) : Lemma (requires (B.rcreate_post_common r init len b h0 h1)) (ensures (modifies loc_none h0 h1))
val modifies_buffer_rcreate_post_common (#a: Type) (r: HS.rid) (init: a) (len: FStar.UInt32.t) (b: B.buffer a) (h0 h1: HS.mem) : Lemma (requires (B.rcreate_post_common r init len b h0 h1)) (ensures (modifies loc_none h0 h1))
let modifies_buffer_rcreate_post_common #a r init len b h0 h1 = MG.modifies_none_intro #_ #cls h0 h1 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ())
{ "file_name": "ulib/FStar.Modifies.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 19, "end_line": 410, "start_col": 0, "start_line": 406 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Modifies module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = FStar.Buffer module U32 = FStar.UInt32 noeq type loc_aux : Type = | LocBuffer: (#t: Type) -> (b: B.buffer t) -> loc_aux let loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0 = match l with | LocBuffer b -> B.frameOf b == r /\ B.as_addr b == n let aloc (r: HS.rid) (n: nat) : Tot (Type u#1) = (l: loc_aux { loc_aux_in_addr l r n } ) let loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0 = match s with | LocBuffer #a0 b0 -> a == a0 /\ b0 `B.includes` b let loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2) = match s2 with | LocBuffer b -> loc_aux_includes_buffer s1 b let loc_aux_includes_refl (s: loc_aux) : Lemma (loc_aux_includes s s) = () let loc_aux_includes_buffer_includes (#a: Type) (s: loc_aux) (b1 b2: B.buffer a) : Lemma (requires (loc_aux_includes_buffer s b1 /\ b1 `B.includes` b2)) (ensures (loc_aux_includes_buffer s b2)) = () let loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes_buffer s2 b)) (ensures (loc_aux_includes_buffer s1 b)) = match s2 with | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b let loc_aux_includes_trans (s1 s2 s3: loc_aux) : Lemma (requires (loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3)) (ensures (loc_aux_includes s1 s3)) = match s3 with | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b (* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *) let loc_aux_includes_trans' (s1 s2: loc_aux) (s3: loc_aux) : Lemma ((loc_aux_includes s1 s2 /\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3) = Classical.move_requires (loc_aux_includes_trans s1 s2) s3 let loc_aux_disjoint_buffer (l: loc_aux) (#t: Type) (p: B.buffer t) : GTot Type0 = match l with | LocBuffer b -> B.disjoint b p let loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0 = match l2 with | LocBuffer b -> loc_aux_disjoint_buffer l1 b let loc_aux_disjoint_sym (l1 l2: loc_aux) : Lemma (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)) = () let loc_aux_disjoint_buffer_includes (l: loc_aux) (#t: Type) (p1: B.buffer t) (p2: B.buffer t) : Lemma (requires (loc_aux_disjoint_buffer l p1 /\ p1 `B.includes` p2)) (ensures (loc_aux_disjoint_buffer l p2)) = () let loc_aux_disjoint_loc_aux_includes_buffer (l1 l2: loc_aux) (#t3: Type) (b3: B.buffer t3) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes_buffer l2 b3)) (ensures (loc_aux_disjoint_buffer l1 b3)) = match l2 with | LocBuffer b2 -> loc_aux_disjoint_buffer_includes l1 b2 b3 let loc_aux_disjoint_loc_aux_includes (l1 l2 l3: loc_aux) : Lemma (requires (loc_aux_disjoint l1 l2 /\ loc_aux_includes l2 l3)) (ensures (loc_aux_disjoint l1 l3)) = match l3 with | LocBuffer b3 -> loc_aux_disjoint_loc_aux_includes_buffer l1 l2 b3 let loc_aux_preserved (l: loc_aux) (h1 h2: HS.mem) : GTot Type0 = match l with | LocBuffer b -> ( B.live h1 b ) ==> ( B.live h2 b /\ B.as_seq h2 b == B.as_seq h1 b ) module MG = FStar.ModifiesGen let cls : MG.cls aloc = MG.Cls #aloc (fun #r #a -> loc_aux_includes) (fun #r #a x -> ()) (fun #r #a x1 x2 x3 -> ()) (fun #r #a -> loc_aux_disjoint) (fun #r #a x1 x2 -> ()) (fun #r #a larger1 larger2 smaller1 smaller2 -> ()) (fun #r #a -> loc_aux_preserved) (fun #r #a x h -> ()) (fun #r #a x h1 h2 h3 -> ()) (fun #r #a b h1 h2 f -> match b with | LocBuffer b' -> let g () : Lemma (requires (B.live h1 b')) (ensures (loc_aux_preserved b h1 h2)) = f _ _ (B.content b') in Classical.move_requires g () ) let loc = MG.loc cls let loc_none = MG.loc_none let loc_union = MG.loc_union let loc_union_idem = MG.loc_union_idem let loc_union_comm = MG.loc_union_comm let loc_union_assoc = MG.loc_union_assoc let loc_union_loc_none_l = MG.loc_union_loc_none_l let loc_union_loc_none_r = MG.loc_union_loc_none_r let loc_buffer #t b = MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_addresses = MG.loc_addresses let loc_regions = MG.loc_regions let loc_includes = MG.loc_includes let loc_includes_refl = MG.loc_includes_refl let loc_includes_trans = MG.loc_includes_trans let loc_includes_union_r = MG.loc_includes_union_r let loc_includes_union_l = MG.loc_includes_union_l let loc_includes_none = MG.loc_includes_none let loc_includes_buffer #t b1 b2 = MG.loc_includes_aloc #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) (LocBuffer b2) let loc_includes_gsub_buffer_r l #t b i len = loc_includes_trans l (loc_buffer b) (loc_buffer (B.sub b i len)) let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 = () let loc_includes_addresses_buffer #t preserve_liveness r s p = MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p) let loc_includes_region_buffer #t preserve_liveness s b = MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls let loc_includes_region_region = MG.loc_includes_region_region #_ #cls let loc_includes_region_union_l = MG.loc_includes_region_union_l let loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls let loc_disjoint = MG.loc_disjoint let loc_disjoint_sym = MG.loc_disjoint_sym let loc_disjoint_none_r = MG.loc_disjoint_none_r let loc_disjoint_union_r = MG.loc_disjoint_union_r let loc_disjoint_includes = MG.loc_disjoint_includes let loc_disjoint_buffer #t1 #t2 b1 b2 = MG.loc_disjoint_aloc_intro #_ #cls #(B.frameOf b1) #(B.as_addr b1) #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b1) (LocBuffer b2) let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 = () let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls let loc_disjoint_buffer_addresses #t p preserve_liveness r n = MG.loc_disjoint_aloc_addresses_intro #_ #cls #(B.frameOf p) #(B.as_addr p) (LocBuffer p) preserve_liveness r n let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls let modifies = MG.modifies let modifies_mreference_elim = MG.modifies_mreference_elim let modifies_buffer_elim #t1 b p h h' = MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h' let modifies_refl = MG.modifies_refl let modifies_loc_includes = MG.modifies_loc_includes let address_liveness_insensitive_locs = MG.address_liveness_insensitive_locs _ let region_liveness_insensitive_locs = MG.region_liveness_insensitive_locs _ let address_liveness_insensitive_buffer #t b = MG.loc_includes_address_liveness_insensitive_locs_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let address_liveness_insensitive_addresses = MG.loc_includes_address_liveness_insensitive_locs_addresses cls let region_liveness_insensitive_buffer #t b = MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) let region_liveness_insensitive_addresses = MG.loc_includes_region_liveness_insensitive_locs_loc_addresses cls let region_liveness_insensitive_regions = MG.loc_includes_region_liveness_insensitive_locs_loc_regions cls let region_liveness_insensitive_address_liveness_insensitive = MG.loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs cls let modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness let modifies_liveness_insensitive_buffer l1 l2 h h' #t x = MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x) let modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness let modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference let modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x = MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x) let modifies_trans = MG.modifies_trans let modifies_only_live_regions = MG.modifies_only_live_regions let no_upd_fresh_region = MG.no_upd_fresh_region let modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped let modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls let modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro let modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls let modifies_salloc_post = MG.modifies_salloc_post #_ #cls let modifies_free = MG.modifies_free #_ #cls let modifies_none_modifies = MG.modifies_none_modifies #_ #cls let modifies_buffer_none_modifies h1 h2 = MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_0_modifies h1 h2 = B.lemma_reveal_modifies_0 h1 h2; MG.modifies_none_intro #_ #cls h1 h2 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ()) let modifies_1_modifies #a b h1 h2 = B.lemma_reveal_modifies_1 b h1 h2; MG.modifies_intro (loc_buffer b) h1 h2 (fun _ -> ()) (fun t' pre' b' -> MG.loc_disjoint_sym (loc_mreference b') (loc_buffer b); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun t' pre' b' -> ()) (fun r n -> ()) (fun r' a' b' -> MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b) #(B.as_addr b) b' (LocBuffer b) ) let modifies_2_modifies #a1 #a2 b1 b2 h1 h2 = B.lemma_reveal_modifies_2 b1 b2 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_buffer b2)) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_buffer b2)) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2) ) #set-options "--z3rlimit 20" let modifies_3_modifies #a1 #a2 #a3 b1 b2 b3 h1 h2 = B.lemma_reveal_modifies_3 b1 b2 b3 h1 h2; MG.modifies_intro (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 (fun _ -> ()) (fun t' pre' b' -> loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b1); loc_disjoint_sym (loc_mreference b') (loc_buffer b1); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b1) #(B.as_addr b1) (LocBuffer b1) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b2); loc_disjoint_sym (loc_mreference b') (loc_buffer b2); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b2) #(B.as_addr b2) (LocBuffer b2) true (HS.frameOf b') (Set.singleton (HS.as_addr b')); loc_disjoint_includes (loc_mreference b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (loc_mreference b') (loc_buffer b3); loc_disjoint_sym (loc_mreference b') (loc_buffer b3); MG.loc_disjoint_aloc_addresses_elim #_ #cls #(B.frameOf b3) #(B.as_addr b3) (LocBuffer b3) true (HS.frameOf b') (Set.singleton (HS.as_addr b')) ) (fun _ _ _ -> ()) (fun _ _ -> ()) (fun r' a' b' -> loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b1); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b1) #(B.as_addr b1) b' (LocBuffer b1); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b2); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b2) #(B.as_addr b2) b' (LocBuffer b2); loc_disjoint_includes (MG.loc_of_aloc b') (loc_union (loc_buffer b1) (loc_union (loc_buffer b2) (loc_buffer b3))) (MG.loc_of_aloc b') (loc_buffer b3); MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(B.frameOf b3) #(B.as_addr b3) b' (LocBuffer b3) ) #reset-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.ModifiesGen.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked", "FStar.Buffer.fst.checked" ], "interface_file": true, "source_file": "FStar.Modifies.fst" }
[ { "abbrev": true, "full_module": "FStar.ModifiesGen", "short_module": "MG" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: FStar.Monotonic.HyperHeap.rid -> init: a -> len: FStar.UInt32.t -> b: FStar.Buffer.buffer a -> h0: FStar.Monotonic.HyperStack.mem -> h1: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires FStar.Buffer.rcreate_post_common r init len b h0 h1) (ensures FStar.Modifies.modifies FStar.Modifies.loc_none h0 h1)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Monotonic.HyperHeap.rid", "FStar.UInt32.t", "FStar.Buffer.buffer", "FStar.Monotonic.HyperStack.mem", "FStar.ModifiesGen.modifies_none_intro", "FStar.Modifies.aloc", "FStar.Modifies.cls", "Prims.unit", "FStar.Preorder.preorder", "FStar.Monotonic.HyperStack.mreference", "Prims.nat" ]
[]
false
false
true
false
false
let modifies_buffer_rcreate_post_common #a r init len b h0 h1 =
MG.modifies_none_intro #_ #cls h0 h1 (fun _ -> ()) (fun _ _ _ -> ()) (fun _ _ -> ())
false