-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"fstar_exe": "fstar.exe", | ||
"options": [ | ||
"--max_fuel", "0", | ||
"--max_ifuel", "2", | ||
"--initial_ifuel", "2" | ||
], | ||
"include_dirs": [ | ||
"./src/lowparse", | ||
"${KRML_HOME}/krmllib", | ||
"${KRML_HOME}/krmllib/obj", | ||
"./src/3d", | ||
"./src/3d/prelude" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module EverParse3d.AppCtxt | ||
module B = LowStar.Buffer | ||
module HS = FStar.HyperStack | ||
module U64 = FStar.UInt64 | ||
module U8 = FStar.UInt8 | ||
open LowStar.Buffer | ||
open FStar.HyperStack.ST | ||
val region : HS.rid | ||
let app_ctxt = x:B.pointer U8.t { B.frameOf x == region } | ||
let loc_of (x:app_ctxt) : GTot B.loc = B.loc_buffer x | ||
let properties (x:app_ctxt) | ||
: Lemma ( | ||
B.loc_region_only true region `loc_includes` loc_of x /\ | ||
B.address_liveness_insensitive_locs `B.loc_includes` loc_of x | ||
) | ||
= () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,50 @@ | ||
module EverParse3d.CopyBuffer | ||
module AppCtxt = EverParse3d.AppCtxt | ||
module I = EverParse3d.InputStream.All | ||
module B = LowStar.Buffer | ||
module HS = FStar.HyperStack | ||
module U64 = FStar.UInt64 | ||
open LowStar.Buffer | ||
open FStar.HyperStack.ST | ||
val region : HS.rid | ||
|
||
val t : Type0 | ||
|
||
val as_input_stream : t -> (sl:I.t & I.tlen sl) | ||
val as_input_stream : t -> (sl:I.t & I.tlen sl) | ||
|
||
let stream_of (x:t) = dfst (as_input_stream x) | ||
|
||
let loc_of (x:t) : GTot B.loc = | ||
I.footprint (stream_of x) | ||
|
||
let liveness_preserved (x:t) = | ||
let sl = stream_of x in | ||
forall l h0 h1. {:pattern (modifies l h0 h1)} | ||
(I.live sl h0 /\ | ||
B.modifies l h0 h1 /\ | ||
address_liveness_insensitive_locs `loc_includes` l) ==> | ||
I.live sl h1 | ||
|
||
val properties (x:t) | ||
: Lemma ( | ||
liveness_preserved x /\ | ||
B.loc_region_only true region `loc_includes` loc_of x /\ | ||
region `HS.disjoint` AppCtxt.region | ||
) | ||
|
||
|
||
let probe_fn = src:U64.t -> len:U64.t -> dest:t -> | ||
Stack bool | ||
(fun h0 -> | ||
I.live (stream_of dest) h0) | ||
(fun h0 b h1 -> | ||
let sl = stream_of dest in | ||
I.live sl h1 /\ | ||
(if b | ||
then ( | ||
Seq.length (I.get_read sl h1) == 0 /\ | ||
modifies (I.footprint sl) h0 h1 | ||
) | ||
else ( | ||
h0 == h1 | ||
))) |