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
Spec.Box.Test.fst
Spec.Box.Test.sk1
val sk1:lbytes 32
val sk1:lbytes 32
let sk1 : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy ] in assert_norm (List.Tot.length l == 32); of_list l
{ "file_name": "specs/tests/Spec.Box.Test.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 11, "end_line": 58, "start_col": 0, "start_line": 50 }
module Spec.Box.Test open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Box #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let plain : lbytes 72 = let l = List.Tot.map u8_from_UInt8 [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy ] in assert_norm (List.Tot.length l == 72); of_list l let nonce : lbytes 24 = let l = List.Tot.map u8_from_UInt8 [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy ] in assert_norm (List.Tot.length l == 24); of_list l let key : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy ] in assert_norm (List.Tot.length l == 32); of_list l
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.IO.fst.checked" ], "interface_file": false, "source_file": "Spec.Box.Test.fst" }
[ { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 32
Prims.Tot
[ "total" ]
[]
[ "Lib.Sequence.of_list", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "FStar.List.Tot.Base.length", "Prims.list", "FStar.List.Tot.Base.map", "FStar.UInt8.t", "Lib.RawIntTypes.u8_from_UInt8", "Prims.Cons", "FStar.UInt8.__uint_to_t", "Prims.Nil" ]
[]
false
false
false
false
false
let sk1:lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy ] in assert_norm (List.Tot.length l == 32); of_list l
false
Hacl.Impl.HSalsa20.fst
Hacl.Impl.HSalsa20.hsalsa20_init
val hsalsa20_init: ctx:state -> k:lbuffer uint8 32ul -> n:lbuffer uint8 16ul -> Stack unit (requires fun h -> live h ctx /\ live h k /\ live h n /\ disjoint ctx k /\ disjoint ctx n /\ as_seq h ctx == Lib.Sequence.create 16 (u32 0)) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ as_seq h1 ctx == Spec.hsalsa20_init (as_seq h0 k) (as_seq h0 n))
val hsalsa20_init: ctx:state -> k:lbuffer uint8 32ul -> n:lbuffer uint8 16ul -> Stack unit (requires fun h -> live h ctx /\ live h k /\ live h n /\ disjoint ctx k /\ disjoint ctx n /\ as_seq h ctx == Lib.Sequence.create 16 (u32 0)) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ as_seq h1 ctx == Spec.hsalsa20_init (as_seq h0 k) (as_seq h0 n))
let hsalsa20_init ctx k n = let h0 = ST.get() in push_frame(); let k32 = create 8ul (u32 0) in let n32 = create 4ul (u32 0) in let h0' = ST.get() in uints_from_bytes_le k32 k; uints_from_bytes_le n32 n; let k0 = sub k32 0ul 4ul in let k1 = sub k32 4ul 4ul in ctx.(0ul) <- Spec.constant0; update_sub #MUT ctx 1ul 4ul k0; ctx.(5ul) <- Spec.constant1; update_sub #MUT ctx 6ul 4ul n32; ctx.(10ul) <- Spec.constant2; update_sub #MUT ctx 11ul 4ul k1; ctx.(15ul) <- Spec.constant3; let h1' = ST.get() in assert (modifies (loc ctx |+| loc k32 |+| loc n32) h0' h1'); pop_frame(); let h1 = ST.get() in assert (modifies (loc ctx) h0 h1)
{ "file_name": "code/salsa20/Hacl.Impl.HSalsa20.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 35, "end_line": 55, "start_col": 0, "start_line": 34 }
module Hacl.Impl.HSalsa20 open FStar.HyperStack open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Hacl.Impl.Salsa20.Core32 module ST = FStar.HyperStack.ST module Spec = Spec.Salsa20 module Loop = Lib.LoopCombinators module Salsa20 = Hacl.Impl.Salsa20 #set-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1" inline_for_extraction val hsalsa20_init: ctx:state -> k:lbuffer uint8 32ul -> n:lbuffer uint8 16ul -> Stack unit (requires fun h -> live h ctx /\ live h k /\ live h n /\ disjoint ctx k /\ disjoint ctx n /\ as_seq h ctx == Lib.Sequence.create 16 (u32 0)) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ as_seq h1 ctx == Spec.hsalsa20_init (as_seq h0 k) (as_seq h0 n))
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Salsa20.Core32.fst.checked", "Hacl.Impl.Salsa20.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.HSalsa20.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Salsa20", "short_module": "Salsa20" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Spec.Salsa20", "short_module": "Spec" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Salsa20.Core32", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ctx: Hacl.Impl.Salsa20.Core32.state -> k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Hacl.Impl.Salsa20.Core32.state", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Prims._assert", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Lib.Buffer.MUT", "Lib.IntTypes.uint32", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "FStar.HyperStack.ST.pop_frame", "Lib.Buffer.op_Bar_Plus_Bar", "Lib.IntTypes.uint_t", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.Buffer.op_Array_Assignment", "Spec.Salsa20.constant3", "Lib.Buffer.update_sub", "Spec.Salsa20.constant2", "Spec.Salsa20.constant1", "Spec.Salsa20.constant0", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Lib.Buffer.sub", "Lib.ByteBuffer.uints_from_bytes_le", "Lib.Buffer.create", "Lib.IntTypes.u32", "FStar.HyperStack.ST.push_frame" ]
[]
false
true
false
false
false
let hsalsa20_init ctx k n =
let h0 = ST.get () in push_frame (); let k32 = create 8ul (u32 0) in let n32 = create 4ul (u32 0) in let h0' = ST.get () in uints_from_bytes_le k32 k; uints_from_bytes_le n32 n; let k0 = sub k32 0ul 4ul in let k1 = sub k32 4ul 4ul in ctx.(0ul) <- Spec.constant0; update_sub #MUT ctx 1ul 4ul k0; ctx.(5ul) <- Spec.constant1; update_sub #MUT ctx 6ul 4ul n32; ctx.(10ul) <- Spec.constant2; update_sub #MUT ctx 11ul 4ul k1; ctx.(15ul) <- Spec.constant3; let h1' = ST.get () in assert (modifies (loc ctx |+| loc k32 |+| loc n32) h0' h1'); pop_frame (); let h1 = ST.get () in assert (modifies (loc ctx) h0 h1)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.reify_trivial
val reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l)
val reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l)
let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ())
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 14, "end_line": 224, "start_col": 0, "start_line": 218 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
f: (_: Prims.unit -> LowParseWriters.EWrite a) -> LowParseWriters.NoHoare.repr a p1 p2 l
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "Prims.unit", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.NoHoare.repr" ]
[]
false
false
false
false
false
let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) =
reify (f ())
false
Spec.Box.Test.fst
Spec.Box.Test.plain
val plain:lbytes 72
val plain:lbytes 72
let plain : lbytes 72 = let l = List.Tot.map u8_from_UInt8 [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy ] in assert_norm (List.Tot.length l == 72); of_list l
{ "file_name": "specs/tests/Spec.Box.Test.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 11, "end_line": 26, "start_col": 0, "start_line": 13 }
module Spec.Box.Test open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Box #set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.IO.fst.checked" ], "interface_file": false, "source_file": "Spec.Box.Test.fst" }
[ { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 72
Prims.Tot
[ "total" ]
[]
[ "Lib.Sequence.of_list", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "FStar.List.Tot.Base.length", "Prims.list", "FStar.List.Tot.Base.map", "FStar.UInt8.t", "Lib.RawIntTypes.u8_from_UInt8", "Prims.Cons", "FStar.UInt8.__uint_to_t", "Prims.Nil" ]
[]
false
false
false
false
false
let plain:lbytes 72 =
let l = List.Tot.map u8_from_UInt8 [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy ] in assert_norm (List.Tot.length l == 72); of_list l
false
Spec.Box.Test.fst
Spec.Box.Test.key
val key:lbytes 32
val key:lbytes 32
let key : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy ] in assert_norm (List.Tot.length l == 32); of_list l
{ "file_name": "specs/tests/Spec.Box.Test.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 11, "end_line": 47, "start_col": 0, "start_line": 39 }
module Spec.Box.Test open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Box #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let plain : lbytes 72 = let l = List.Tot.map u8_from_UInt8 [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy ] in assert_norm (List.Tot.length l == 72); of_list l let nonce : lbytes 24 = let l = List.Tot.map u8_from_UInt8 [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy ] in assert_norm (List.Tot.length l == 24); of_list l
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.IO.fst.checked" ], "interface_file": false, "source_file": "Spec.Box.Test.fst" }
[ { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 32
Prims.Tot
[ "total" ]
[]
[ "Lib.Sequence.of_list", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "FStar.List.Tot.Base.length", "Prims.list", "FStar.List.Tot.Base.map", "FStar.UInt8.t", "Lib.RawIntTypes.u8_from_UInt8", "Prims.Cons", "FStar.UInt8.__uint_to_t", "Prims.Nil" ]
[]
false
false
false
false
false
let key:lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy ] in assert_norm (List.Tot.length l == 32); of_list l
false
Pulse.Checker.VPropEquiv.fst
Pulse.Checker.VPropEquiv.list_as_vprop_assoc
val list_as_vprop_assoc (g:env) (vp0 vp1 vp2:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2))) (list_as_vprop ((vp0 @ vp1) @ vp2)))
val list_as_vprop_assoc (g:env) (vp0 vp1 vp2:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2))) (list_as_vprop ((vp0 @ vp1) @ vp2)))
let list_as_vprop_assoc g (vp0 vp1 vp2:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2))) (list_as_vprop ((vp0 @ vp1) @ vp2))) = List.Tot.append_assoc vp0 vp1 vp2; VE_Refl _ _
{ "file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 15, "end_line": 69, "start_col": 0, "start_line": 65 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Pulse.Checker.VPropEquiv open Pulse.Syntax open Pulse.Typing open FStar.List.Tot let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let rec list_as_vprop_append g (vp0 vp1:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (list_as_vprop vp0) (list_as_vprop vp1))) (decreases vp0) = match vp0 with | [] -> let v : vprop_equiv g (list_as_vprop vp1) (tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _) in v | [hd] -> (* Need to check vp1 too in this case *) begin match vp1 with | [] -> VE_Sym _ _ _ (VE_Trans _ _ _ _ (VE_Comm g hd tm_emp) (VE_Unit _ hd)) | _::_ -> VE_Refl _ _ end | hd::tl -> let tl_vp1 = list_as_vprop_append g tl vp1 in let d : vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1))) = VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1 in let d : vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1)) = VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in d let list_as_vprop_comm g (vp0 vp1:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp1 @ vp0))) = let d1 : _ = list_as_vprop_append g vp0 vp1 in let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in VE_Trans _ _ _ _ d1 d2
{ "checked_file": "/", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Pulse.Checker.VPropEquiv.fst" }
[ { "abbrev": false, "full_module": "Pulse.Checker.Base", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
g: Pulse.Typing.Env.env -> vp0: Prims.list Pulse.Syntax.Base.term -> vp1: Prims.list Pulse.Syntax.Base.term -> vp2: Prims.list Pulse.Syntax.Base.term -> Prims.GTot (Pulse.Typing.vprop_equiv g (Pulse.Typing.Combinators.list_as_vprop (vp0 @ vp1 @ vp2)) (Pulse.Typing.Combinators.list_as_vprop ((vp0 @ vp1) @ vp2)))
Prims.GTot
[ "sometrivial" ]
[]
[ "Pulse.Typing.Env.env", "Prims.list", "Pulse.Syntax.Base.term", "Pulse.Typing.VE_Refl", "Pulse.Typing.Combinators.list_as_vprop", "FStar.List.Tot.Base.op_At", "Prims.unit", "FStar.List.Tot.Properties.append_assoc", "Pulse.Typing.vprop_equiv" ]
[]
false
false
false
false
false
let list_as_vprop_assoc g (vp0: list term) (vp1: list term) (vp2: list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2))) (list_as_vprop ((vp0 @ vp1) @ vp2))) =
List.Tot.append_assoc vp0 vp1 vp2; VE_Refl _ _
false
Pulse.Checker.VPropEquiv.fst
Pulse.Checker.VPropEquiv.list_as_vprop_append
val list_as_vprop_append (g:env) (vp0 vp1:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (list_as_vprop vp0) (list_as_vprop vp1)))
val list_as_vprop_append (g:env) (vp0 vp1:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (list_as_vprop vp0) (list_as_vprop vp1)))
let rec list_as_vprop_append g (vp0 vp1:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (list_as_vprop vp0) (list_as_vprop vp1))) (decreases vp0) = match vp0 with | [] -> let v : vprop_equiv g (list_as_vprop vp1) (tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _) in v | [hd] -> (* Need to check vp1 too in this case *) begin match vp1 with | [] -> VE_Sym _ _ _ (VE_Trans _ _ _ _ (VE_Comm g hd tm_emp) (VE_Unit _ hd)) | _::_ -> VE_Refl _ _ end | hd::tl -> let tl_vp1 = list_as_vprop_append g tl vp1 in let d : vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1))) = VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1 in let d : vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1)) = VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in d
{ "file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 7, "end_line": 54, "start_col": 0, "start_line": 25 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Pulse.Checker.VPropEquiv open Pulse.Syntax open Pulse.Typing open FStar.List.Tot let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
{ "checked_file": "/", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Pulse.Checker.VPropEquiv.fst" }
[ { "abbrev": false, "full_module": "Pulse.Checker.Base", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
g: Pulse.Typing.Env.env -> vp0: Prims.list Pulse.Syntax.Base.term -> vp1: Prims.list Pulse.Syntax.Base.term -> Prims.GTot (Pulse.Typing.vprop_equiv g (Pulse.Typing.Combinators.list_as_vprop (vp0 @ vp1)) (Pulse.Syntax.Base.tm_star (Pulse.Typing.Combinators.list_as_vprop vp0) (Pulse.Typing.Combinators.list_as_vprop vp1)))
Prims.GTot
[ "", "sometrivial" ]
[]
[ "Pulse.Typing.Env.env", "Prims.list", "Pulse.Syntax.Base.term", "Pulse.Typing.vprop_equiv", "Pulse.Typing.Combinators.list_as_vprop", "Pulse.Syntax.Base.tm_star", "Pulse.Syntax.Base.tm_emp", "Pulse.Typing.VE_Sym", "Pulse.Typing.VE_Unit", "Pulse.Typing.VE_Trans", "Pulse.Typing.VE_Comm", "Pulse.Typing.VE_Refl", "FStar.List.Tot.Base.op_At", "Pulse.Typing.VE_Assoc", "Pulse.Typing.VE_Ctxt", "Pulse.Checker.VPropEquiv.list_as_vprop_append" ]
[ "recursion" ]
false
false
false
false
false
let rec list_as_vprop_append g (vp0: list term) (vp1: list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (list_as_vprop vp0) (list_as_vprop vp1))) (decreases vp0) =
match vp0 with | [] -> let v:vprop_equiv g (list_as_vprop vp1) (tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _) in v | [hd] -> (match vp1 with | [] -> VE_Sym _ _ _ (VE_Trans _ _ _ _ (VE_Comm g hd tm_emp) (VE_Unit _ hd)) | _ :: _ -> VE_Refl _ _) | hd :: tl -> let tl_vp1 = list_as_vprop_append g tl vp1 in let d:vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1))) = VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1 in let d:vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1)) = VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in d
false
Spec.Box.Test.fst
Spec.Box.Test.sk2
val sk2:lbytes 32
val sk2:lbytes 32
let sk2 : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1cuy ] in assert_norm (List.Tot.length l == 32); of_list l
{ "file_name": "specs/tests/Spec.Box.Test.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 11, "end_line": 69, "start_col": 0, "start_line": 61 }
module Spec.Box.Test open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Box #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let plain : lbytes 72 = let l = List.Tot.map u8_from_UInt8 [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy ] in assert_norm (List.Tot.length l == 72); of_list l let nonce : lbytes 24 = let l = List.Tot.map u8_from_UInt8 [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x20uy; 0x21uy; 0x22uy; 0x23uy ] in assert_norm (List.Tot.length l == 24); of_list l let key : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy ] in assert_norm (List.Tot.length l == 32); of_list l let sk1 : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy ] in assert_norm (List.Tot.length l == 32); of_list l
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.IO.fst.checked" ], "interface_file": false, "source_file": "Spec.Box.Test.fst" }
[ { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "Spec.Box", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 32
Prims.Tot
[ "total" ]
[]
[ "Lib.Sequence.of_list", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "FStar.List.Tot.Base.length", "Prims.list", "FStar.List.Tot.Base.map", "FStar.UInt8.t", "Lib.RawIntTypes.u8_from_UInt8", "Prims.Cons", "FStar.UInt8.__uint_to_t", "Prims.Nil" ]
[]
false
false
false
false
false
let sk2:lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1cuy ] in assert_norm (List.Tot.length l == 32); of_list l
false
Pulse.Checker.VPropEquiv.fst
Pulse.Checker.VPropEquiv.vprop_list_equiv
val vprop_list_equiv (g:env) (vp:term) : GTot (vprop_equiv g vp (canon_vprop vp))
val vprop_list_equiv (g:env) (vp:term) : GTot (vprop_equiv g vp (canon_vprop vp))
let rec vprop_list_equiv (g:env) (vp:term) : GTot (vprop_equiv g vp (canon_vprop vp)) (decreases vp) = match vp.t with | Tm_Emp -> VE_Refl _ _ | Tm_Star vp0 vp1 -> let eq0 = vprop_list_equiv g vp0 in let eq1 = vprop_list_equiv g vp1 in let app_eq : vprop_equiv _ (canon_vprop vp) (tm_star (canon_vprop vp0) (canon_vprop vp1)) = list_as_vprop_append g (vprop_as_list vp0) (vprop_as_list vp1) in let step : vprop_equiv _ vp (tm_star (canon_vprop vp0) (canon_vprop vp1)) = VE_Ctxt _ _ _ _ _ eq0 eq1 in VE_Trans _ _ _ _ step (VE_Sym _ _ _ app_eq) | _ -> VE_Refl _ _
{ "file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 17, "end_line": 107, "start_col": 0, "start_line": 87 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Pulse.Checker.VPropEquiv open Pulse.Syntax open Pulse.Typing open FStar.List.Tot let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let rec list_as_vprop_append g (vp0 vp1:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (list_as_vprop vp0) (list_as_vprop vp1))) (decreases vp0) = match vp0 with | [] -> let v : vprop_equiv g (list_as_vprop vp1) (tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _) in v | [hd] -> (* Need to check vp1 too in this case *) begin match vp1 with | [] -> VE_Sym _ _ _ (VE_Trans _ _ _ _ (VE_Comm g hd tm_emp) (VE_Unit _ hd)) | _::_ -> VE_Refl _ _ end | hd::tl -> let tl_vp1 = list_as_vprop_append g tl vp1 in let d : vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1))) = VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1 in let d : vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1)) = VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in d let list_as_vprop_comm g (vp0 vp1:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp1 @ vp0))) = let d1 : _ = list_as_vprop_append g vp0 vp1 in let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in VE_Trans _ _ _ _ d1 d2 let list_as_vprop_assoc g (vp0 vp1 vp2:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2))) (list_as_vprop ((vp0 @ vp1) @ vp2))) = List.Tot.append_assoc vp0 vp1 vp2; VE_Refl _ _ let list_as_vprop_ctx g (vp0 vp0' vp1 vp1':list term) (d0:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0')) (d1:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1')) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1'))) = let split_app = list_as_vprop_append _ vp0 vp1 in let split_app' = list_as_vprop_append _ vp0' vp1' in let ctxt = VE_Ctxt _ _ _ _ _ d0 d1 in VE_Trans _ _ _ _ split_app (VE_Trans _ _ _ _ ctxt (VE_Sym _ _ _ split_app')) let list_as_vprop_singleton g (p q:term) (d:vprop_equiv g p q) : GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q])) = d
{ "checked_file": "/", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Pulse.Checker.VPropEquiv.fst" }
[ { "abbrev": false, "full_module": "Pulse.Checker.Base", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
g: Pulse.Typing.Env.env -> vp: Pulse.Syntax.Base.term -> Prims.GTot (Pulse.Typing.vprop_equiv g vp (Pulse.Checker.VPropEquiv.canon_vprop vp))
Prims.GTot
[ "", "sometrivial" ]
[]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.__proj__Mkterm__item__t", "Pulse.Typing.VE_Refl", "Pulse.Typing.VE_Trans", "Pulse.Syntax.Base.tm_star", "Pulse.Checker.VPropEquiv.canon_vprop", "Pulse.Typing.VE_Sym", "Pulse.Typing.vprop_equiv", "Pulse.Typing.VE_Ctxt", "Pulse.Checker.VPropEquiv.list_as_vprop_append", "Pulse.Typing.Combinators.vprop_as_list", "Pulse.Checker.VPropEquiv.vprop_list_equiv", "Pulse.Syntax.Base.term'" ]
[ "recursion" ]
false
false
false
false
false
let rec vprop_list_equiv (g: env) (vp: term) : GTot (vprop_equiv g vp (canon_vprop vp)) (decreases vp) =
match vp.t with | Tm_Emp -> VE_Refl _ _ | Tm_Star vp0 vp1 -> let eq0 = vprop_list_equiv g vp0 in let eq1 = vprop_list_equiv g vp1 in let app_eq:vprop_equiv _ (canon_vprop vp) (tm_star (canon_vprop vp0) (canon_vprop vp1)) = list_as_vprop_append g (vprop_as_list vp0) (vprop_as_list vp1) in let step:vprop_equiv _ vp (tm_star (canon_vprop vp0) (canon_vprop vp1)) = VE_Ctxt _ _ _ _ _ eq0 eq1 in VE_Trans _ _ _ _ step (VE_Sym _ _ _ app_eq) | _ -> VE_Refl _ _
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.read_return
val read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv)
val read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv)
let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 47, "end_line": 35, "start_col": 0, "start_line": 29 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Type -> x: t -> inv: LowParseWriters.memory_invariant -> LowParseWriters.NoHoare.read_repr t inv
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.NoHoare.read_reify_trivial", "LowParseWriters.NoHoare.read_return_conv", "LowParseWriters.NoHoare.read_repr" ]
[]
false
false
false
false
false
let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) =
read_reify_trivial (read_return_conv t x inv)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.read_return_conv
val read_return_conv: t: Type -> x: t -> inv: memory_invariant -> Prims.unit -> ERead t True (fun _ -> True) (fun _ -> True) inv
val read_return_conv: t: Type -> x: t -> inv: memory_invariant -> Prims.unit -> ERead t True (fun _ -> True) (fun _ -> True) inv
let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 26, "start_col": 0, "start_line": 20 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Type -> x: t -> inv: LowParseWriters.memory_invariant -> _: Prims.unit -> LowParseWriters.ERead t
LowParseWriters.ERead
[]
[]
[ "LowParseWriters.memory_invariant", "Prims.unit", "Prims.l_True" ]
[]
false
true
false
false
false
let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv =
x
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.read_bind_conv
val read_bind_conv: a: Type -> b: Type -> l_f: memory_invariant -> l_g: memory_invariant -> squash (l_f == l_g) -> f_bind: read_repr a l_f -> g: (x: a -> read_repr b l_g) -> Prims.unit -> ERead b True (fun _ -> True) (fun _ -> True) l_g
val read_bind_conv: a: Type -> b: Type -> l_f: memory_invariant -> l_g: memory_invariant -> squash (l_f == l_g) -> f_bind: read_repr a l_f -> g: (x: a -> read_repr b l_g) -> Prims.unit -> ERead b True (fun _ -> True) (fun _ -> True) l_g
let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 22, "end_line": 48, "start_col": 0, "start_line": 38 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> b: Type -> l_f: LowParseWriters.memory_invariant -> l_g: LowParseWriters.memory_invariant -> _: Prims.squash (l_f == l_g) -> f_bind: LowParseWriters.NoHoare.read_repr a l_f -> g: (x: a -> LowParseWriters.NoHoare.read_repr b l_g) -> _: Prims.unit -> LowParseWriters.ERead b
LowParseWriters.ERead
[]
[]
[ "LowParseWriters.memory_invariant", "Prims.squash", "Prims.eq2", "LowParseWriters.NoHoare.read_repr", "Prims.unit", "Prims.l_True" ]
[]
false
true
false
false
false
let read_bind_conv (a: Type) (b: Type) (l_f: memory_invariant) (l_g: memory_invariant) (_: squash (l_f == l_g)) (f_bind: read_repr a l_f) (g: (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g =
let x = ERead?.reflect f_bind in ERead?.reflect (g x)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.valid_rewrite_prop
val valid_rewrite_prop (p1 p2: parser) : GTot Type0
val valid_rewrite_prop (p1 p2: parser) : GTot Type0
let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 43, "end_line": 288, "start_col": 0, "start_line": 287 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowParseWriters.LowParse.parser -> p2: LowParseWriters.LowParse.parser -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "LowParseWriters.LowParse.parser", "Prims.l_Exists", "LowParseWriters.NoHoare.valid_rewrite_t'", "Prims.l_True" ]
[]
false
false
false
false
true
let valid_rewrite_prop (p1 p2: parser) : GTot Type0 =
exists (x: valid_rewrite_t' p1 p2). True
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.lift_pure_read_conv
val lift_pure_read_conv: a: Type -> wp: pure_wp a -> l: memory_invariant -> f_pure: (unit -> PURE a wp) -> sq: squash (wp (fun _ -> True)) -> Prims.unit -> ERead a True (fun _ -> True) (fun _ -> True) l
val lift_pure_read_conv: a: Type -> wp: pure_wp a -> l: memory_invariant -> f_pure: (unit -> PURE a wp) -> sq: squash (wp (fun _ -> True)) -> Prims.unit -> ERead a True (fun _ -> True) (fun _ -> True) l
let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure ()
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 11, "end_line": 110, "start_col": 0, "start_line": 104 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> wp: Prims.pure_wp a -> l: LowParseWriters.memory_invariant -> f_pure: (_: Prims.unit -> Prims.PURE a) -> sq: Prims.squash (wp (fun _ -> Prims.l_True)) -> _: Prims.unit -> LowParseWriters.ERead a
LowParseWriters.ERead
[]
[]
[ "Prims.pure_wp", "LowParseWriters.memory_invariant", "Prims.unit", "Prims.squash", "Prims.l_True" ]
[]
false
true
false
false
false
let lift_pure_read_conv (a: Type) (wp: pure_wp a) (l: memory_invariant) (f_pure: (unit -> PURE a wp)) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l =
f_pure ()
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.read_subcomp_conv
val read_subcomp_conv: a: Type -> l: memory_invariant -> l': memory_invariant -> f_subcomp: read_repr a l -> sq: squash (l `memory_invariant_includes` l') -> Prims.unit -> ERead a True (fun _ -> True) (fun _ -> True) l'
val read_subcomp_conv: a: Type -> l: memory_invariant -> l': memory_invariant -> f_subcomp: read_repr a l -> sq: squash (l `memory_invariant_includes` l') -> Prims.unit -> ERead a True (fun _ -> True) (fun _ -> True) l'
let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 70, "start_col": 0, "start_line": 62 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> l: LowParseWriters.memory_invariant -> l': LowParseWriters.memory_invariant -> f_subcomp: LowParseWriters.NoHoare.read_repr a l -> sq: Prims.squash (LowParseWriters.memory_invariant_includes l l') -> _: Prims.unit -> LowParseWriters.ERead a
LowParseWriters.ERead
[]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.NoHoare.read_repr", "Prims.squash", "LowParseWriters.memory_invariant_includes", "Prims.unit", "Prims.l_True" ]
[]
false
true
false
false
false
let read_subcomp_conv (a: Type) (l: memory_invariant) (l': memory_invariant) (f_subcomp: read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' =
let x = ERead?.reflect f_subcomp in x
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.read_bind
val read_bind (a b: Type) ([@@@ refl_implicit]l_f [@@@ refl_implicit]l_g: memory_invariant) ([@@@ refl_implicit]p: squash (l_f == l_g)) (f_bind: read_repr a l_f) (g: (x: a -> read_repr b l_g)) : Tot (read_repr b l_g)
val read_bind (a b: Type) ([@@@ refl_implicit]l_f [@@@ refl_implicit]l_g: memory_invariant) ([@@@ refl_implicit]p: squash (l_f == l_g)) (f_bind: read_repr a l_f) (g: (x: a -> read_repr b l_g)) : Tot (read_repr b l_g)
let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 61, "end_line": 59, "start_col": 0, "start_line": 51 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> b: Type -> l_f: LowParseWriters.memory_invariant -> l_g: LowParseWriters.memory_invariant -> p: Prims.squash (l_f == l_g) -> f_bind: LowParseWriters.NoHoare.read_repr a l_f -> g: (x: a -> LowParseWriters.NoHoare.read_repr b l_g) -> LowParseWriters.NoHoare.read_repr b l_g
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.memory_invariant", "Prims.squash", "Prims.eq2", "LowParseWriters.NoHoare.read_repr", "LowParseWriters.NoHoare.read_reify_trivial", "LowParseWriters.NoHoare.read_bind_conv" ]
[]
false
false
false
false
false
let read_bind (a b: Type) ([@@@ refl_implicit]l_f [@@@ refl_implicit]l_g: memory_invariant) ([@@@ refl_implicit]p: squash (l_f == l_g)) (f_bind: read_repr a l_f) (g: (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) =
read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.read_subcomp
val read_subcomp (a: Type) (l l': memory_invariant) (f_subcomp: read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True))
val read_subcomp (a: Type) (l l': memory_invariant) (f_subcomp: read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True))
let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ())
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 60, "end_line": 80, "start_col": 0, "start_line": 73 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> l: LowParseWriters.memory_invariant -> l': LowParseWriters.memory_invariant -> f_subcomp: LowParseWriters.NoHoare.read_repr a l -> Prims.Pure (LowParseWriters.NoHoare.read_repr a l')
Prims.Pure
[]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.NoHoare.read_repr", "LowParseWriters.NoHoare.read_reify_trivial", "LowParseWriters.NoHoare.read_subcomp_conv", "LowParseWriters.memory_invariant_includes", "Prims.l_True" ]
[]
false
false
false
false
false
let read_subcomp (a: Type) (l l': memory_invariant) (f_subcomp: read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) =
read_reify_trivial (read_subcomp_conv a l l' f_subcomp ())
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.destr_repr_spec
val destr_repr_spec (#a: Type u#x) (#r_in #r_out: parser) (#l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True))
val destr_repr_spec (#a: Type u#x) (#r_in #r_out: parser) (#l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True))
let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ()))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 464, "start_col": 0, "start_line": 457 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
$f_destr_spec: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> LowParseWriters.repr_spec a r_in r_out (fun _ -> Prims.l_True) (fun _ _ _ -> Prims.l_True) (fun _ -> Prims.l_True)
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.unit", "LowParseWriters.__proj__Repr__item__spec", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.repr_spec" ]
[]
false
false
false
false
false
let destr_repr_spec (#a: Type u#x) (#r_in #r_out: parser) (#l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) =
Repr?.spec (reify (f_destr_spec ()))
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.lift_pure_read'
val lift_pure_read' (a: Type) (wp: pure_wp a) (l: memory_invariant) (f_pure: (unit -> PURE a wp)) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True))
val lift_pure_read' (a: Type) (wp: pure_wp a) (l: memory_invariant) (f_pure: (unit -> PURE a wp)) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True))
let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ())
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 59, "end_line": 119, "start_col": 0, "start_line": 113 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> wp: Prims.pure_wp a -> l: LowParseWriters.memory_invariant -> f_pure: (_: Prims.unit -> Prims.PURE a) -> Prims.Pure (LowParseWriters.NoHoare.read_repr a l)
Prims.Pure
[]
[]
[ "Prims.pure_wp", "LowParseWriters.memory_invariant", "Prims.unit", "LowParseWriters.NoHoare.read_reify_trivial", "LowParseWriters.NoHoare.lift_pure_read_conv", "LowParseWriters.NoHoare.read_repr", "Prims.l_True" ]
[]
false
false
false
false
false
let lift_pure_read' (a: Type) (wp: pure_wp a) (l: memory_invariant) (f_pure: (unit -> PURE a wp)) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) =
read_reify_trivial (lift_pure_read_conv a wp l f_pure ())
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.tread_of_eread
val tread_of_eread (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : TRead a l
val tread_of_eread (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : TRead a l
let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 39, "end_line": 160, "start_col": 0, "start_line": 155 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
f: (_: Prims.unit -> LowParseWriters.ERead a) -> LowParseWriters.NoHoare.TRead a
LowParseWriters.NoHoare.TRead
[]
[]
[ "LowParseWriters.memory_invariant", "Prims.unit", "Prims.l_True", "LowParseWriters.NoHoare.read_reify_trivial" ]
[]
false
true
false
false
false
let tread_of_eread (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : TRead a l =
TRead?.reflect (read_reify_trivial f)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.destr_repr_impl
val destr_repr_impl (#a: Type u#x) (#r_in #r_out: parser) (#l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec))
val destr_repr_impl (#a: Type u#x) (#r_in #r_out: parser) (#l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec))
let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ()))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 474, "start_col": 0, "start_line": 467 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ()))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
$f_destr_spec: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> LowParseWriters.repr_impl a r_in r_out (fun _ -> Prims.l_True) (fun _ _ _ -> Prims.l_True) (fun _ -> Prims.l_True) l (LowParseWriters.NoHoare.destr_repr_spec f_destr_spec)
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.unit", "LowParseWriters.__proj__Repr__item__impl", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.repr_impl", "LowParseWriters.NoHoare.destr_repr_spec" ]
[]
false
false
false
false
false
let destr_repr_impl (#a: Type u#x) (#r_in #r_out: parser) (#l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) =
Repr?.impl (reify (f_destr_spec ()))
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.eread_of_tread
val eread_of_tread (#a: Type) (#l: memory_invariant) (f: (unit -> TRead a l)) : ERead a True (fun _ -> True) (fun _ -> True) l
val eread_of_tread (#a: Type) (#l: memory_invariant) (f: (unit -> TRead a l)) : ERead a True (fun _ -> True) (fun _ -> True) l
let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ()))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 31, "end_line": 168, "start_col": 0, "start_line": 163 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
f: (_: Prims.unit -> LowParseWriters.NoHoare.TRead a) -> LowParseWriters.ERead a
LowParseWriters.ERead
[]
[]
[ "LowParseWriters.memory_invariant", "Prims.unit", "Prims.l_True" ]
[]
false
true
false
false
false
let eread_of_tread (#a: Type) (#l: memory_invariant) (f: (unit -> TRead a l)) : ERead a True (fun _ -> True) (fun _ -> True) l =
ERead?.reflect (reify (f ()))
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.buffer_sub
val buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ (B.loc_buffer b) `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv
val buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ (B.loc_buffer b) `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv
let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 46, "end_line": 206, "start_col": 0, "start_line": 195 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowStar.Buffer.buffer t -> i: FStar.UInt32.t -> len: FStar.Ghost.erased FStar.UInt32.t { LowStar.Monotonic.Buffer.live (FStar.Ghost.reveal (Mkmemory_invariant?.h0 inv)) b /\ LowStar.Monotonic.Buffer.loc_disjoint (LowStar.Monotonic.Buffer.loc_buffer b) (FStar.Ghost.reveal (Mkmemory_invariant?.lwrite inv)) /\ FStar.UInt32.v i + FStar.UInt32.v (FStar.Ghost.reveal len) <= LowStar.Monotonic.Buffer.length b } -> LowParseWriters.NoHoare.TRead (LowStar.Buffer.buffer t)
LowParseWriters.NoHoare.TRead
[]
[]
[ "LowParseWriters.memory_invariant", "LowStar.Buffer.buffer", "FStar.UInt32.t", "FStar.Ghost.erased", "Prims.l_and", "LowStar.Monotonic.Buffer.live", "LowStar.Buffer.trivial_preorder", "FStar.Ghost.reveal", "FStar.Monotonic.HyperStack.mem", "LowParseWriters.__proj__Mkmemory_invariant__item__h0", "LowStar.Monotonic.Buffer.loc_disjoint", "LowStar.Monotonic.Buffer.loc_buffer", "LowStar.Monotonic.Buffer.loc", "LowParseWriters.__proj__Mkmemory_invariant__item__lwrite", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "FStar.UInt32.v", "LowStar.Monotonic.Buffer.length", "LowParseWriters.NoHoare.tread_of_eread", "Prims.unit", "LowParseWriters.buffer_sub" ]
[]
false
true
false
false
false
let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ (B.loc_buffer b) `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv =
tread_of_eread (fun _ -> buffer_sub b i len)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.buffer_index
val buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ (B.loc_buffer b) `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv
val buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ (B.loc_buffer b) `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv
let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 44, "end_line": 192, "start_col": 0, "start_line": 182 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowStar.Buffer.buffer t -> i: FStar.UInt32.t { LowStar.Monotonic.Buffer.live (FStar.Ghost.reveal (Mkmemory_invariant?.h0 inv)) b /\ LowStar.Monotonic.Buffer.loc_disjoint (LowStar.Monotonic.Buffer.loc_buffer b) (FStar.Ghost.reveal (Mkmemory_invariant?.lwrite inv)) /\ FStar.UInt32.v i < LowStar.Monotonic.Buffer.length b } -> LowParseWriters.NoHoare.TRead t
LowParseWriters.NoHoare.TRead
[]
[]
[ "LowParseWriters.memory_invariant", "LowStar.Buffer.buffer", "FStar.UInt32.t", "Prims.l_and", "LowStar.Monotonic.Buffer.live", "LowStar.Buffer.trivial_preorder", "FStar.Ghost.reveal", "FStar.Monotonic.HyperStack.mem", "LowParseWriters.__proj__Mkmemory_invariant__item__h0", "LowStar.Monotonic.Buffer.loc_disjoint", "LowStar.Monotonic.Buffer.loc_buffer", "LowStar.Monotonic.Buffer.loc", "LowParseWriters.__proj__Mkmemory_invariant__item__lwrite", "Prims.b2t", "Prims.op_LessThan", "FStar.UInt32.v", "LowStar.Monotonic.Buffer.length", "LowParseWriters.NoHoare.tread_of_eread", "Prims.unit", "LowParseWriters.buffer_index" ]
[]
false
true
false
false
false
let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ (B.loc_buffer b) `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv =
tread_of_eread (fun _ -> buffer_index b i)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.extract
val extract (#a: Type u#x) (#r_in #r_out: parser) (l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot (extract_t l f_destr_spec)
val extract (#a: Type u#x) (#r_in #r_out: parser) (l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot (extract_t l f_destr_spec)
let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 66, "end_line": 526, "start_col": 0, "start_line": 519 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end )))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowParseWriters.memory_invariant -> $f_destr_spec: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> LowParseWriters.NoHoare.extract_t l f_destr_spec
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.unit", "LowParseWriters.extract_repr_impl", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.NoHoare.destr_repr_spec", "LowParseWriters.NoHoare.destr_repr_impl", "LowParseWriters.NoHoare.extract_t" ]
[]
false
false
false
false
false
let extract (#a: Type u#x) (#r_in #r_out: parser) (l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot (extract_t l f_destr_spec) =
extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.failwith
val failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv
val failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv
let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 176, "start_col": 0, "start_line": 171 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ()))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: Prims.string -> LowParseWriters.NoHoare.TRead a
LowParseWriters.NoHoare.TRead
[]
[]
[ "LowParseWriters.memory_invariant", "Prims.string", "LowParseWriters.NoHoare.tread_of_eread", "Prims.unit", "LowParseWriters.failwith" ]
[]
false
true
false
false
false
let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv =
tread_of_eread (fun _ -> failwith s)
false
Pulse.Checker.VPropEquiv.fst
Pulse.Checker.VPropEquiv.vprop_equiv_split_frame
val vprop_equiv_split_frame (g:_) (ctxt req:term) (frame:list term) (d:vprop_equiv g (list_as_vprop (vprop_as_list req @ frame)) (list_as_vprop (vprop_as_list ctxt))) : vprop_equiv g (tm_star req (list_as_vprop frame)) ctxt
val vprop_equiv_split_frame (g:_) (ctxt req:term) (frame:list term) (d:vprop_equiv g (list_as_vprop (vprop_as_list req @ frame)) (list_as_vprop (vprop_as_list ctxt))) : vprop_equiv g (tm_star req (list_as_vprop frame)) ctxt
let vprop_equiv_split_frame (g:_) (ctxt req:term) (frame:list term) (veq:vprop_equiv g (list_as_vprop (vprop_as_list req @ frame)) (list_as_vprop (vprop_as_list ctxt))) : vprop_equiv g (tm_star req (list_as_vprop frame)) ctxt = let ctxt_l = vprop_as_list ctxt in let req_l = vprop_as_list req in let veq : vprop_equiv g (list_as_vprop (req_l @ frame)) (list_as_vprop ctxt_l) = veq in let d1 : vprop_equiv _ (tm_star (canon_vprop req) (list_as_vprop frame)) (list_as_vprop (req_l @ frame)) = VE_Sym _ _ _ (list_as_vprop_append g req_l frame) in let d1 : vprop_equiv _ (tm_star req (list_as_vprop frame)) (list_as_vprop (req_l @ frame)) = VE_Trans _ _ _ _ (VE_Ctxt _ _ _ _ _ (vprop_list_equiv g req) (VE_Refl _ _)) d1 in let d : vprop_equiv _ (tm_star req (list_as_vprop frame)) (canon_vprop ctxt) = VE_Trans _ _ _ _ d1 veq in let d : vprop_equiv _ (tm_star req (list_as_vprop frame)) ctxt = VE_Trans _ _ _ _ d (VE_Sym _ _ _ (vprop_list_equiv g ctxt)) in d
{ "file_name": "lib/steel/pulse/Pulse.Checker.VPropEquiv.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 5, "end_line": 160, "start_col": 0, "start_line": 134 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Pulse.Checker.VPropEquiv open Pulse.Syntax open Pulse.Typing open FStar.List.Tot let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let rec list_as_vprop_append g (vp0 vp1:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (list_as_vprop vp0) (list_as_vprop vp1))) (decreases vp0) = match vp0 with | [] -> let v : vprop_equiv g (list_as_vprop vp1) (tm_star tm_emp (list_as_vprop vp1)) = VE_Sym _ _ _ (VE_Unit _ _) in v | [hd] -> (* Need to check vp1 too in this case *) begin match vp1 with | [] -> VE_Sym _ _ _ (VE_Trans _ _ _ _ (VE_Comm g hd tm_emp) (VE_Unit _ hd)) | _::_ -> VE_Refl _ _ end | hd::tl -> let tl_vp1 = list_as_vprop_append g tl vp1 in let d : vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star hd (tm_star (list_as_vprop tl) (list_as_vprop vp1))) = VE_Ctxt _ _ _ _ _ (VE_Refl _ hd) tl_vp1 in let d : vprop_equiv g (list_as_vprop (vp0 @ vp1)) (tm_star (tm_star hd (list_as_vprop tl)) (list_as_vprop vp1)) = VE_Trans _ _ _ _ d (VE_Assoc _ _ _ _) in d let list_as_vprop_comm g (vp0 vp1:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp1 @ vp0))) = let d1 : _ = list_as_vprop_append g vp0 vp1 in let d2 : _ = VE_Sym _ _ _ (list_as_vprop_append g vp1 vp0) in let d1 : _ = VE_Trans _ _ _ _ d1 (VE_Comm _ _ _) in VE_Trans _ _ _ _ d1 d2 let list_as_vprop_assoc g (vp0 vp1 vp2:list term) : GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2))) (list_as_vprop ((vp0 @ vp1) @ vp2))) = List.Tot.append_assoc vp0 vp1 vp2; VE_Refl _ _ let list_as_vprop_ctx g (vp0 vp0' vp1 vp1':list term) (d0:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0')) (d1:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1')) : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1'))) = let split_app = list_as_vprop_append _ vp0 vp1 in let split_app' = list_as_vprop_append _ vp0' vp1' in let ctxt = VE_Ctxt _ _ _ _ _ d0 d1 in VE_Trans _ _ _ _ split_app (VE_Trans _ _ _ _ ctxt (VE_Sym _ _ _ split_app')) let list_as_vprop_singleton g (p q:term) (d:vprop_equiv g p q) : GTot (vprop_equiv g (list_as_vprop [p]) (list_as_vprop [q])) = d let rec vprop_list_equiv (g:env) (vp:term) : GTot (vprop_equiv g vp (canon_vprop vp)) (decreases vp) = match vp.t with | Tm_Emp -> VE_Refl _ _ | Tm_Star vp0 vp1 -> let eq0 = vprop_list_equiv g vp0 in let eq1 = vprop_list_equiv g vp1 in let app_eq : vprop_equiv _ (canon_vprop vp) (tm_star (canon_vprop vp0) (canon_vprop vp1)) = list_as_vprop_append g (vprop_as_list vp0) (vprop_as_list vp1) in let step : vprop_equiv _ vp (tm_star (canon_vprop vp0) (canon_vprop vp1)) = VE_Ctxt _ _ _ _ _ eq0 eq1 in VE_Trans _ _ _ _ step (VE_Sym _ _ _ app_eq) | _ -> VE_Refl _ _ let vprop_equiv_swap_equiv (g:_) (l0 l2:list term) (p q:term) (d_p_q:vprop_equiv g p q) : vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2)) (list_as_vprop ([p] @ (l0 @ l2))) = let d : vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2)) (list_as_vprop (([q] @ l0) @ l2)) = list_as_vprop_ctx g (l0 @ [q]) ([q] @ l0) l2 l2 (list_as_vprop_comm g l0 [q]) (VE_Refl _ _) in let d' : vprop_equiv g (list_as_vprop (([q] @ l0) @ l2)) (list_as_vprop ([q] @ (l0 @ l2))) = List.Tot.append_assoc [q] l0 l2; VE_Refl _ _ in let d : vprop_equiv g (list_as_vprop ((l0 @ [q]) @ l2)) (list_as_vprop ([q] @ (l0 @ l2))) = VE_Trans _ _ _ _ d d' in let d_q_p = VE_Sym _ _ _ d_p_q in let d' : vprop_equiv g (list_as_vprop [q]) (list_as_vprop [p]) = d_q_p in let d' : vprop_equiv g (list_as_vprop ([q] @ (l0 @ l2))) (list_as_vprop ([p] @ (l0 @ l2))) = list_as_vprop_ctx g [q] [p] (l0 @ l2) _ d' (VE_Refl _ _) in VE_Trans _ _ _ _ d d'
{ "checked_file": "/", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Pulse.Checker.VPropEquiv.fst" }
[ { "abbrev": false, "full_module": "Pulse.Checker.Base", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
g: Pulse.Typing.Env.env -> ctxt: Pulse.Syntax.Base.term -> req: Pulse.Syntax.Base.term -> frame: Prims.list Pulse.Syntax.Base.term -> d: Pulse.Typing.vprop_equiv g (Pulse.Typing.Combinators.list_as_vprop (Pulse.Typing.Combinators.vprop_as_list req @ frame) ) (Pulse.Typing.Combinators.list_as_vprop (Pulse.Typing.Combinators.vprop_as_list ctxt)) -> Pulse.Typing.vprop_equiv g (Pulse.Syntax.Base.tm_star req (Pulse.Typing.Combinators.list_as_vprop frame)) ctxt
Prims.Tot
[ "total" ]
[]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.term", "Prims.list", "Pulse.Typing.vprop_equiv", "Pulse.Typing.Combinators.list_as_vprop", "FStar.List.Tot.Base.op_At", "Pulse.Typing.Combinators.vprop_as_list", "Pulse.Syntax.Base.tm_star", "Pulse.Typing.VE_Trans", "Pulse.Checker.VPropEquiv.canon_vprop", "Pulse.Typing.VE_Sym", "Pulse.Checker.VPropEquiv.vprop_list_equiv", "Pulse.Typing.VE_Ctxt", "Pulse.Typing.VE_Refl", "Pulse.Checker.VPropEquiv.list_as_vprop_append" ]
[]
false
false
false
false
false
let vprop_equiv_split_frame (g: _) (ctxt req: term) (frame: list term) (veq: vprop_equiv g (list_as_vprop (vprop_as_list req @ frame)) (list_as_vprop (vprop_as_list ctxt))) : vprop_equiv g (tm_star req (list_as_vprop frame)) ctxt =
let ctxt_l = vprop_as_list ctxt in let req_l = vprop_as_list req in let veq:vprop_equiv g (list_as_vprop (req_l @ frame)) (list_as_vprop ctxt_l) = veq in let d1:vprop_equiv _ (tm_star (canon_vprop req) (list_as_vprop frame)) (list_as_vprop (req_l @ frame)) = VE_Sym _ _ _ (list_as_vprop_append g req_l frame) in let d1:vprop_equiv _ (tm_star req (list_as_vprop frame)) (list_as_vprop (req_l @ frame)) = VE_Trans _ _ _ _ (VE_Ctxt _ _ _ _ _ (vprop_list_equiv g req) (VE_Refl _ _)) d1 in let d:vprop_equiv _ (tm_star req (list_as_vprop frame)) (canon_vprop ctxt) = VE_Trans _ _ _ _ d1 veq in let d:vprop_equiv _ (tm_star req (list_as_vprop frame)) ctxt = VE_Trans _ _ _ _ d (VE_Sym _ _ _ (vprop_list_equiv g ctxt)) in d
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.return_conv
val return_conv: t: Type -> x: t -> r: parser -> inv: memory_invariant -> Prims.unit -> EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv
val return_conv: t: Type -> x: t -> r: parser -> inv: memory_invariant -> Prims.unit -> EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv
let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 234, "start_col": 0, "start_line": 227 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Type -> x: t -> r: LowParseWriters.LowParse.parser -> inv: LowParseWriters.memory_invariant -> _: Prims.unit -> LowParseWriters.EWrite t
LowParseWriters.EWrite
[]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.unit", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True" ]
[]
false
true
false
false
false
let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv =
x
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.bind
val bind (a b: Type) (r_in_f [@@@ refl_implicit]r_out_f: parser) ([@@@ refl_implicit]l_f: memory_invariant) ([@@@ refl_implicit]r_in_g r_out_g: parser) ([@@@ refl_implicit]l_g: memory_invariant) ([@@@ refl_implicit]pr1: squash (r_out_f == r_in_g)) ([@@@ refl_implicit]pr2: squash (l_f == l_g)) (f_bind: repr a r_in_f r_out_f l_f) (g: (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g)
val bind (a b: Type) (r_in_f [@@@ refl_implicit]r_out_f: parser) ([@@@ refl_implicit]l_f: memory_invariant) ([@@@ refl_implicit]r_in_g r_out_g: parser) ([@@@ refl_implicit]l_g: memory_invariant) ([@@@ refl_implicit]pr1: squash (r_out_f == r_in_g)) ([@@@ refl_implicit]pr2: squash (l_f == l_g)) (f_bind: repr a r_in_f r_out_f l_f) (g: (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g)
let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 84, "end_line": 275, "start_col": 0, "start_line": 263 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> b: Type -> r_in_f: LowParseWriters.LowParse.parser -> r_out_f: LowParseWriters.LowParse.parser -> l_f: LowParseWriters.memory_invariant -> r_in_g: LowParseWriters.LowParse.parser -> r_out_g: LowParseWriters.LowParse.parser -> l_g: LowParseWriters.memory_invariant -> pr1: Prims.squash (r_out_f == r_in_g) -> pr2: Prims.squash (l_f == l_g) -> f_bind: LowParseWriters.NoHoare.repr a r_in_f r_out_f l_f -> g: (x: a -> LowParseWriters.NoHoare.repr b r_in_g r_out_g l_g) -> LowParseWriters.NoHoare.repr b r_in_f r_out_g l_g
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.squash", "Prims.eq2", "LowParseWriters.NoHoare.repr", "LowParseWriters.NoHoare.reify_trivial", "LowParseWriters.NoHoare.bind_conv" ]
[]
false
false
false
false
false
let bind (a b: Type) (r_in_f [@@@ refl_implicit]r_out_f: parser) ([@@@ refl_implicit]l_f: memory_invariant) ([@@@ refl_implicit]r_in_g r_out_g: parser) ([@@@ refl_implicit]l_g: memory_invariant) ([@@@ refl_implicit]pr1: squash (r_out_f == r_in_g)) ([@@@ refl_implicit]pr2: squash (l_f == l_g)) (f_bind: repr a r_in_f r_out_f l_f) (g: (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) =
reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.returnc
val returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv)
val returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv)
let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 39, "end_line": 243, "start_col": 0, "start_line": 237 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Type -> x: t -> r: LowParseWriters.LowParse.parser -> inv: LowParseWriters.memory_invariant -> LowParseWriters.NoHoare.repr t r r inv
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "LowParseWriters.NoHoare.reify_trivial", "LowParseWriters.NoHoare.return_conv", "LowParseWriters.NoHoare.repr" ]
[]
false
false
false
false
false
let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) =
reify_trivial (return_conv t x r inv)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.bind_spec2
val bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3))
val bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3))
let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 72, "end_line": 576, "start_col": 0, "start_line": 568 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
inv: LowParseWriters.memory_invariant -> p1: LowParseWriters.LowParse.parser -> p2: LowParseWriters.LowParse.parser -> p3: LowParseWriters.LowParse.parser -> a: Type -> b: Type -> f: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> g: (_: a -> _: Prims.unit -> LowParseWriters.NoHoare.TWrite b) -> v1: Parser?.t p1 -> Prims.GTot (LowParseWriters.result (b * Parser?.t p3))
Prims.GTot
[ "sometrivial" ]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "Prims.unit", "LowParseWriters.LowParse.__proj__Parser__item__t", "LowParseWriters.NoHoare.bind_spec2_aux", "LowParseWriters.NoHoare.repr", "LowParseWriters.result", "FStar.Pervasives.Native.tuple2" ]
[]
false
false
false
false
false
let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) =
bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite_f
val evalid_rewrite_of_tvalid_rewrite_f (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2)
val evalid_rewrite_of_tvalid_rewrite_f (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2)
let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 20, "end_line": 316, "start_col": 0, "start_line": 309 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
v: Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p2) -> x: Parser?.t p1 -> Prims.GTot (Parser?.t p2)
Prims.GTot
[ "sometrivial" ]
[]
[ "LowParseWriters.LowParse.parser", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop", "LowParseWriters.LowParse.__proj__Parser__item__t", "LowParseWriters.NoHoare.__proj__ValidSynth__item__f", "LowParseWriters.NoHoare.valid_rewrite_t'", "FStar.IndefiniteDescription.indefinite_description_ghost", "Prims.l_True", "Prims.prop" ]
[]
false
false
false
false
false
let evalid_rewrite_of_tvalid_rewrite_f (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) =
let v':valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.bind_conv
val bind_conv: a: Type -> b: Type -> r_in_f: parser -> r_out_f: parser -> l_f: memory_invariant -> r_in_g: parser -> r_out_g: parser -> l_g: memory_invariant -> squash (r_out_f == r_in_g) -> squash (l_f == l_g) -> f_bind: repr a r_in_f r_out_f l_f -> g: (x: a -> repr b r_in_g r_out_g l_g) -> Prims.unit -> EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g
val bind_conv: a: Type -> b: Type -> r_in_f: parser -> r_out_f: parser -> l_f: memory_invariant -> r_in_g: parser -> r_out_g: parser -> l_g: memory_invariant -> squash (r_out_f == r_in_g) -> squash (l_f == l_g) -> f_bind: repr a r_in_f r_out_f l_f -> g: (x: a -> repr b r_in_g r_out_g l_g) -> Prims.unit -> EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g
let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 23, "end_line": 260, "start_col": 0, "start_line": 246 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> b: Type -> r_in_f: LowParseWriters.LowParse.parser -> r_out_f: LowParseWriters.LowParse.parser -> l_f: LowParseWriters.memory_invariant -> r_in_g: LowParseWriters.LowParse.parser -> r_out_g: LowParseWriters.LowParse.parser -> l_g: LowParseWriters.memory_invariant -> _: Prims.squash (r_out_f == r_in_g) -> _: Prims.squash (l_f == l_g) -> f_bind: LowParseWriters.NoHoare.repr a r_in_f r_out_f l_f -> g: (x: a -> LowParseWriters.NoHoare.repr b r_in_g r_out_g l_g) -> _: Prims.unit -> LowParseWriters.EWrite b
LowParseWriters.EWrite
[]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.squash", "Prims.eq2", "LowParseWriters.NoHoare.repr", "Prims.unit", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True" ]
[]
false
true
false
false
false
let bind_conv (a: Type) (b: Type) (r_in_f: parser) (r_out_f: parser) (l_f: memory_invariant) (r_in_g: parser) (r_out_g: parser) (l_g: memory_invariant) (_: squash (r_out_f == r_in_g)) (_: squash (l_f == l_g)) (f_bind: repr a r_in_f r_out_f l_f) (g: (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g =
let x = EWrite?.reflect f_bind in EWrite?.reflect (g x)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.tvalid_rewrite_of_evalid_rewrite
val tvalid_rewrite_of_evalid_rewrite (#p1 #p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 {precond x} -> GTot (Parser?.t p2))) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f {forall (x: Parser?.t p1). precond x}) : Tot (squash (valid_rewrite_prop p1 p2))
val tvalid_rewrite_of_evalid_rewrite (#p1 #p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 {precond x} -> GTot (Parser?.t p2))) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f {forall (x: Parser?.t p1). precond x}) : Tot (squash (valid_rewrite_prop p1 p2))
let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in ()
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 4, "end_line": 307, "start_col": 0, "start_line": 296 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
v: LowParseWriters.valid_rewrite_t p1 p2 precond f {forall (x: Parser?.t p1). precond x} -> Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p2)
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.pre_t", "LowParseWriters.LowParse.__proj__Parser__item__t", "LowParseWriters.valid_rewrite_t", "Prims.l_Forall", "LowParseWriters.NoHoare.valid_rewrite_t'", "LowParseWriters.NoHoare.ValidSynth", "LowParseWriters.valid_rewrite_implies", "Prims.l_True", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop" ]
[]
false
false
true
false
false
let tvalid_rewrite_of_evalid_rewrite (#p1 #p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 {precond x} -> GTot (Parser?.t p2))) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f {forall (x: Parser?.t p1). precond x}) : Tot (squash (valid_rewrite_prop p1 p2)) =
let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in ()
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite
val evalid_rewrite_of_tvalid_rewrite (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v))
val evalid_rewrite_of_tvalid_rewrite (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v))
let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 151, "end_line": 323, "start_col": 0, "start_line": 318 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
v: Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p2) -> LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> Prims.l_True) (LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite_f v)
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop", "LowParseWriters.valid_rewrite_implies", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.NoHoare.__proj__ValidSynth__item__f", "FStar.IndefiniteDescription.indefinite_description_ghost", "LowParseWriters.NoHoare.valid_rewrite_t'", "Prims.prop", "LowParseWriters.NoHoare.__proj__ValidSynth__item__v", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite_f", "LowParseWriters.valid_rewrite_t" ]
[]
false
false
false
false
false
let evalid_rewrite_of_tvalid_rewrite (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) =
valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.valid_rewrite_refl
val valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)]
val valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)]
let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in ()
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 4, "end_line": 335, "start_col": 0, "start_line": 325 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowParseWriters.LowParse.parser -> FStar.Pervasives.Lemma (ensures LowParseWriters.NoHoare.valid_rewrite_prop p p) [SMTPat (LowParseWriters.NoHoare.valid_rewrite_prop p p)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "LowParseWriters.LowParse.parser", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop", "LowParseWriters.NoHoare.tvalid_rewrite_of_evalid_rewrite", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.Mkvalid_rewrite_t", "FStar.Monotonic.HyperStack.mem", "LowStar.Buffer.buffer", "FStar.UInt8.t", "FStar.UInt32.t", "Prims.unit", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
false
false
true
false
false
let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] =
let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()) }) in ()
false
OPLSS.Log.fst
OPLSS.Log.t
val t : a: Prims.eqtype -> Type0
let t (a:eqtype) = HST.mref (seq a) grows
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 41, "end_line": 17, "start_col": 0, "start_line": 17 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.eqtype -> Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.eqtype", "FStar.HyperStack.ST.mref", "FStar.Seq.Base.seq", "OPLSS.Log.grows" ]
[]
false
false
false
true
true
let t (a: eqtype) =
HST.mref (seq a) grows
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.subcomp2
val subcomp2 (a: Type) (r_in r_out r_out': parser) (l: memory_invariant) (f_subcomp: repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires (valid_rewrite_prop r_out r_out')) (ensures (fun _ -> True))
val subcomp2 (a: Type) (r_in r_out r_out': parser) (l: memory_invariant) (f_subcomp: repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires (valid_rewrite_prop r_out r_out')) (ensures (fun _ -> True))
let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 170, "end_line": 388, "start_col": 0, "start_line": 377 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> r_in: LowParseWriters.LowParse.parser -> r_out: LowParseWriters.LowParse.parser -> r_out': LowParseWriters.LowParse.parser -> l: LowParseWriters.memory_invariant -> f_subcomp: LowParseWriters.NoHoare.repr a r_in r_out l -> Prims.Pure (LowParseWriters.NoHoare.repr a r_in r_out' l)
Prims.Pure
[]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "LowParseWriters.NoHoare.repr", "LowParseWriters.NoHoare.bind", "Prims.unit", "LowParseWriters.NoHoare.valid_rewrite_repr", "LowParseWriters.NoHoare.returnc", "LowParseWriters.NoHoare.valid_rewrite_prop", "Prims.l_True" ]
[]
false
false
false
false
false
let subcomp2 (a: Type) (r_in r_out r_out': parser) (l: memory_invariant) (f_subcomp: repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires (valid_rewrite_prop r_out r_out')) (ensures (fun _ -> True)) =
bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l))
false
OPLSS.Log.fst
OPLSS.Log.entries
val entries : x: OPLSS.Log.t a -> h: FStar.Monotonic.HyperStack.mem -> Prims.GTot (FStar.Seq.Base.seq a)
let entries #a (x:t a) (h:HS.mem) = HS.sel h x
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 46, "end_line": 21, "start_col": 0, "start_line": 21 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: OPLSS.Log.t a -> h: FStar.Monotonic.HyperStack.mem -> Prims.GTot (FStar.Seq.Base.seq a)
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.eqtype", "OPLSS.Log.t", "FStar.Monotonic.HyperStack.mem", "FStar.Monotonic.HyperStack.sel", "FStar.Seq.Base.seq", "OPLSS.Log.grows" ]
[]
false
false
false
false
false
let entries #a (x: t a) (h: HS.mem) =
HS.sel h x
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.valid_rewrite_compose
val valid_rewrite_compose (#p1 #p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3))
val valid_rewrite_compose (#p1 #p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3))
let valid_rewrite_compose (#p1: parser) (#p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3)) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_compose _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v12) _ _ _ (evalid_rewrite_of_tvalid_rewrite v23))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 150, "end_line": 636, "start_col": 0, "start_line": 629 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s) inline_for_extraction let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ())) inline_for_extraction let frame (#a: Type) (#fr: parser) (#p: parser) (#l: memory_invariant) ($f: unit -> TWrite a parse_empty p l ) : TWrite a fr (fr `parse_pair` p) l = twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
v12: Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p2) -> v23: Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p2 p3) -> Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p3)
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop", "LowParseWriters.NoHoare.tvalid_rewrite_of_evalid_rewrite", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_and", "Prims.l_True", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite_f", "LowParseWriters.valid_rewrite_compose", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite" ]
[]
false
false
true
false
false
let valid_rewrite_compose (#p1 #p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3)) =
tvalid_rewrite_of_evalid_rewrite (valid_rewrite_compose _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v12) _ _ _ (evalid_rewrite_of_tvalid_rewrite v23))
false
OPLSS.Log.fst
OPLSS.Log.fp
val fp : x: OPLSS.Log.t a -> Prims.GTot LowStar.Monotonic.Buffer.loc
let fp #a (x:t a) = B.loc_mreference x
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 19, "start_col": 0, "start_line": 19 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: OPLSS.Log.t a -> Prims.GTot LowStar.Monotonic.Buffer.loc
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.eqtype", "OPLSS.Log.t", "LowStar.Monotonic.Buffer.loc_mreference", "FStar.Seq.Base.seq", "OPLSS.Log.grows", "LowStar.Monotonic.Buffer.loc" ]
[]
false
false
false
false
false
let fp #a (x: t a) =
B.loc_mreference x
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.valid_rewrite_parse_pair_assoc_1
val valid_rewrite_parse_pair_assoc_1 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop ((p1 `parse_pair` p2) `parse_pair` p3) (p1 `parse_pair` (p2 `parse_pair` p3))))
val valid_rewrite_parse_pair_assoc_1 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop ((p1 `parse_pair` p2) `parse_pair` p3) (p1 `parse_pair` (p2 `parse_pair` p3))))
let valid_rewrite_parse_pair_assoc_1 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop ((p1 `parse_pair` p2) `parse_pair` p3) (p1 `parse_pair` (p2 `parse_pair` p3)))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_1 p1 p2 p3)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 78, "end_line": 660, "start_col": 0, "start_line": 657 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s) inline_for_extraction let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ())) inline_for_extraction let frame (#a: Type) (#fr: parser) (#p: parser) (#l: memory_invariant) ($f: unit -> TWrite a parse_empty p l ) : TWrite a fr (fr `parse_pair` p) l = twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f)) let valid_rewrite_compose (#p1: parser) (#p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3)) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_compose _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v12) _ _ _ (evalid_rewrite_of_tvalid_rewrite v23)) inline_for_extraction let valid_rewrite (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv = twrite_of_ewrite (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let cast (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) (x1: ptr p1 inv) : Tot (ptr p2 inv) = cast _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v) _ x1
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowParseWriters.LowParse.parser -> p2: LowParseWriters.LowParse.parser -> p3: LowParseWriters.LowParse.parser -> Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop (LowParseWriters.LowParse.parse_pair (LowParseWriters.LowParse.parse_pair p1 p2) p3) (LowParseWriters.LowParse.parse_pair p1 (LowParseWriters.LowParse.parse_pair p2 p3)))
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.NoHoare.tvalid_rewrite_of_evalid_rewrite", "LowParseWriters.LowParse.parse_pair", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "FStar.Pervasives.Native.Mktuple2", "LowParseWriters.valid_rewrite_parse_pair_assoc_1", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop" ]
[]
false
false
true
false
false
let valid_rewrite_parse_pair_assoc_1 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop ((p1 `parse_pair` p2) `parse_pair` p3) (p1 `parse_pair` (p2 `parse_pair` p3)))) =
tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_1 p1 p2 p3)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.valid_rewrite_parse_pair_compat_r
val valid_rewrite_parse_pair_compat_r (p #p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` p) (p2 `parse_pair` p)))
val valid_rewrite_parse_pair_compat_r (p #p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` p) (p2 `parse_pair` p)))
let valid_rewrite_parse_pair_compat_r (p: parser) (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` p) (p2 `parse_pair` p))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_compat_r p _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 117, "end_line": 680, "start_col": 0, "start_line": 674 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s) inline_for_extraction let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ())) inline_for_extraction let frame (#a: Type) (#fr: parser) (#p: parser) (#l: memory_invariant) ($f: unit -> TWrite a parse_empty p l ) : TWrite a fr (fr `parse_pair` p) l = twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f)) let valid_rewrite_compose (#p1: parser) (#p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3)) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_compose _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v12) _ _ _ (evalid_rewrite_of_tvalid_rewrite v23)) inline_for_extraction let valid_rewrite (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv = twrite_of_ewrite (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let cast (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) (x1: ptr p1 inv) : Tot (ptr p2 inv) = cast _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v) _ x1 let valid_rewrite_parse_pair_assoc_1 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop ((p1 `parse_pair` p2) `parse_pair` p3) (p1 `parse_pair` (p2 `parse_pair` p3)))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_1 p1 p2 p3) let valid_rewrite_parse_pair_assoc_2 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` (p2 `parse_pair` p3)) ((p1 `parse_pair` p2) `parse_pair` p3))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_2 p1 p2 p3) let valid_rewrite_parse_pair_compat_l (p: parser) (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p `parse_pair` p1) (p `parse_pair` p2))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_compat_l p _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowParseWriters.LowParse.parser -> v: Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p2) -> Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop (LowParseWriters.LowParse.parse_pair p1 p) (LowParseWriters.LowParse.parse_pair p2 p))
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop", "LowParseWriters.NoHoare.tvalid_rewrite_of_evalid_rewrite", "LowParseWriters.LowParse.parse_pair", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "FStar.Pervasives.Native.Mktuple2", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite_f", "LowParseWriters.valid_rewrite_parse_pair_compat_r", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite" ]
[]
false
false
true
false
false
let valid_rewrite_parse_pair_compat_r (p #p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` p) (p2 `parse_pair` p))) =
tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_compat_r p _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v))
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.valid_rewrite_parse_pair_assoc_2
val valid_rewrite_parse_pair_assoc_2 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` (p2 `parse_pair` p3)) ((p1 `parse_pair` p2) `parse_pair` p3)))
val valid_rewrite_parse_pair_assoc_2 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` (p2 `parse_pair` p3)) ((p1 `parse_pair` p2) `parse_pair` p3)))
let valid_rewrite_parse_pair_assoc_2 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` (p2 `parse_pair` p3)) ((p1 `parse_pair` p2) `parse_pair` p3))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_2 p1 p2 p3)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 78, "end_line": 665, "start_col": 0, "start_line": 662 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s) inline_for_extraction let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ())) inline_for_extraction let frame (#a: Type) (#fr: parser) (#p: parser) (#l: memory_invariant) ($f: unit -> TWrite a parse_empty p l ) : TWrite a fr (fr `parse_pair` p) l = twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f)) let valid_rewrite_compose (#p1: parser) (#p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3)) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_compose _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v12) _ _ _ (evalid_rewrite_of_tvalid_rewrite v23)) inline_for_extraction let valid_rewrite (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv = twrite_of_ewrite (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let cast (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) (x1: ptr p1 inv) : Tot (ptr p2 inv) = cast _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v) _ x1 let valid_rewrite_parse_pair_assoc_1 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop ((p1 `parse_pair` p2) `parse_pair` p3) (p1 `parse_pair` (p2 `parse_pair` p3)))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_1 p1 p2 p3)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowParseWriters.LowParse.parser -> p2: LowParseWriters.LowParse.parser -> p3: LowParseWriters.LowParse.parser -> Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop (LowParseWriters.LowParse.parse_pair p1 (LowParseWriters.LowParse.parse_pair p2 p3)) (LowParseWriters.LowParse.parse_pair (LowParseWriters.LowParse.parse_pair p1 p2) p3))
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.NoHoare.tvalid_rewrite_of_evalid_rewrite", "LowParseWriters.LowParse.parse_pair", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "FStar.Pervasives.Native.Mktuple2", "LowParseWriters.valid_rewrite_parse_pair_assoc_2", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop" ]
[]
false
false
true
false
false
let valid_rewrite_parse_pair_assoc_2 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` (p2 `parse_pair` p3)) ((p1 `parse_pair` p2) `parse_pair` p3))) =
tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_2 p1 p2 p3)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.cast
val cast (#p1 #p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) (x1: ptr p1 inv) : Tot (ptr p2 inv)
val cast (#p1 #p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) (x1: ptr p1 inv) : Tot (ptr p2 inv)
let cast (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) (x1: ptr p1 inv) : Tot (ptr p2 inv) = cast _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v) _ x1
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 56, "end_line": 655, "start_col": 0, "start_line": 648 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s) inline_for_extraction let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ())) inline_for_extraction let frame (#a: Type) (#fr: parser) (#p: parser) (#l: memory_invariant) ($f: unit -> TWrite a parse_empty p l ) : TWrite a fr (fr `parse_pair` p) l = twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f)) let valid_rewrite_compose (#p1: parser) (#p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3)) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_compose _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v12) _ _ _ (evalid_rewrite_of_tvalid_rewrite v23)) inline_for_extraction let valid_rewrite (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv = twrite_of_ewrite (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
v: Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p2) -> x1: LowParseWriters.ptr p1 inv -> LowParseWriters.ptr p2 inv
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop", "LowParseWriters.ptr", "LowParseWriters.cast", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite_f", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite" ]
[]
false
false
false
false
false
let cast (#p1 #p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) (x1: ptr p1 inv) : Tot (ptr p2 inv) =
cast _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v) _ x1
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.subcomp1
val subcomp1 (a: Type) (r_in r_out: parser) (l l': memory_invariant) (f_subcomp: repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True))
val subcomp1 (a: Type) (r_in r_out: parser) (l l': memory_invariant) (f_subcomp: repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True))
let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ())
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 61, "end_line": 374, "start_col": 0, "start_line": 362 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> r_in: LowParseWriters.LowParse.parser -> r_out: LowParseWriters.LowParse.parser -> l: LowParseWriters.memory_invariant -> l': LowParseWriters.memory_invariant -> f_subcomp: LowParseWriters.NoHoare.repr a r_in r_out l -> Prims.Pure (LowParseWriters.NoHoare.repr a r_in r_out l')
Prims.Pure
[]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "LowParseWriters.NoHoare.repr", "LowParseWriters.NoHoare.reify_trivial", "LowParseWriters.NoHoare.subcomp_conv", "LowParseWriters.memory_invariant_includes", "Prims.l_True" ]
[]
false
false
false
false
false
let subcomp1 (a: Type) (r_in r_out: parser) (l l': memory_invariant) (f_subcomp: repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) =
reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ())
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.extract_t
val extract_t (#a: Type u#x) (#r_in #r_out: parser) (l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot Type
val extract_t (#a: Type u#x) (#r_in #r_out: parser) (l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot Type
let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end )))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 5, "end_line": 516, "start_col": 0, "start_line": 480 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowParseWriters.memory_invariant -> $f_destr_spec: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> Type0
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.unit", "LowStar.Buffer.buffer", "LowParseWriters.LowParse.u8", "LowStar.Monotonic.Buffer.loc_includes", "FStar.Ghost.reveal", "LowStar.Monotonic.Buffer.loc", "LowParseWriters.__proj__Mkmemory_invariant__item__lwrite", "LowStar.Monotonic.Buffer.loc_buffer", "LowStar.Buffer.trivial_preorder", "FStar.UInt32.t", "Prims.eq2", "LowStar.Monotonic.Buffer.len", "LowParseWriters.buffer_offset", "LowParseWriters.iresult", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "LowStar.Monotonic.Buffer.modifies", "LowParseWriters.__proj__Mkmemory_invariant__item__h0", "Prims.b2t", "FStar.Monotonic.HyperHeap.includes", "FStar.Monotonic.HyperStack.get_tip", "LowParseWriters.LowParse.valid_pos", "FStar.UInt32.__uint_to_t", "FStar.Pervasives.Native.Mktuple2", "LowParseWriters.result", "FStar.Pervasives.Native.tuple2", "LowParseWriters.LowParse.__proj__Parser__item__t", "LowParseWriters.NoHoare.destr_repr_spec", "Prims.op_LessThanOrEqual", "FStar.UInt32.v", "LowParseWriters.LowParse.contents", "Prims.op_GreaterThan", "LowParseWriters.LowParse.size", "LowStar.Monotonic.Buffer.length", "Prims.string", "Prims.l_True", "Prims.l_False", "Prims.logical" ]
[]
false
false
false
false
true
let extract_t (#a: Type u#x) (#r_in #r_out: parser) (l: memory_invariant) ($f_destr_spec: (unit -> TWrite a r_in r_out l)) : Tot Type =
b: B.buffer u8 {l.lwrite `B.loc_includes` (B.loc_buffer b)} -> len: U32.t{len == B.len b} -> pos1: buffer_offset b -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ (HS.get_tip l.h0) `HS.includes` (HS.get_tip h) /\ valid_pos r_in h b 0ul pos1)) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ (let v_in = contents r_in h b 0ul pos1 in match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> True | _ -> False)))
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.lift_read_conv
val lift_read_conv: a: Type -> inv: memory_invariant -> r: parser -> f_read_spec: read_repr a inv -> Prims.unit -> EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv
val lift_read_conv: a: Type -> inv: memory_invariant -> r: parser -> f_read_spec: read_repr a inv -> Prims.unit -> EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv
let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 444, "start_col": 0, "start_line": 436 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> inv: LowParseWriters.memory_invariant -> r: LowParseWriters.LowParse.parser -> f_read_spec: LowParseWriters.NoHoare.read_repr a inv -> _: Prims.unit -> LowParseWriters.EWrite a
LowParseWriters.EWrite
[]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "LowParseWriters.NoHoare.read_repr", "Prims.unit", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True" ]
[]
false
true
false
false
false
let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv =
let x = ERead?.reflect f_read_spec in x
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.valid_rewrite_parse_pair_compat_l
val valid_rewrite_parse_pair_compat_l (p #p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p `parse_pair` p1) (p `parse_pair` p2)))
val valid_rewrite_parse_pair_compat_l (p #p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p `parse_pair` p1) (p `parse_pair` p2)))
let valid_rewrite_parse_pair_compat_l (p: parser) (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p `parse_pair` p1) (p `parse_pair` p2))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_compat_l p _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 117, "end_line": 672, "start_col": 0, "start_line": 667 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s) inline_for_extraction let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ())) inline_for_extraction let frame (#a: Type) (#fr: parser) (#p: parser) (#l: memory_invariant) ($f: unit -> TWrite a parse_empty p l ) : TWrite a fr (fr `parse_pair` p) l = twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f)) let valid_rewrite_compose (#p1: parser) (#p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3)) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_compose _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v12) _ _ _ (evalid_rewrite_of_tvalid_rewrite v23)) inline_for_extraction let valid_rewrite (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv = twrite_of_ewrite (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let cast (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) (x1: ptr p1 inv) : Tot (ptr p2 inv) = cast _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v) _ x1 let valid_rewrite_parse_pair_assoc_1 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop ((p1 `parse_pair` p2) `parse_pair` p3) (p1 `parse_pair` (p2 `parse_pair` p3)))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_1 p1 p2 p3) let valid_rewrite_parse_pair_assoc_2 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` (p2 `parse_pair` p3)) ((p1 `parse_pair` p2) `parse_pair` p3))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_2 p1 p2 p3)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowParseWriters.LowParse.parser -> v: Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p2) -> Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop (LowParseWriters.LowParse.parse_pair p p1) (LowParseWriters.LowParse.parse_pair p p2))
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop", "LowParseWriters.NoHoare.tvalid_rewrite_of_evalid_rewrite", "LowParseWriters.LowParse.parse_pair", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "FStar.Pervasives.Native.Mktuple2", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite_f", "LowParseWriters.valid_rewrite_parse_pair_compat_l", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite" ]
[]
false
false
true
false
false
let valid_rewrite_parse_pair_compat_l (p #p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p `parse_pair` p1) (p `parse_pair` p2))) =
tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_compat_l p _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v))
false
OPLSS.Log.fst
OPLSS.Log.has
val has : l: FStar.Seq.Base.seq a -> x: a -> Prims.bool
let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 22, "start_col": 0, "start_line": 22 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: FStar.Seq.Base.seq a -> x: a -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Prims.eqtype", "FStar.Seq.Base.seq", "FStar.Seq.Properties.mem", "Prims.bool" ]
[]
false
false
false
false
false
let has (#a: eqtype) (l: seq a) (x: a) =
Seq.mem x l
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.lift_read
val lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv)
val lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv)
let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 52, "end_line": 453, "start_col": 0, "start_line": 447 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> inv: LowParseWriters.memory_invariant -> r: LowParseWriters.LowParse.parser -> f_read_spec: LowParseWriters.NoHoare.read_repr a inv -> LowParseWriters.NoHoare.repr a r r inv
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "LowParseWriters.NoHoare.read_repr", "LowParseWriters.NoHoare.reify_trivial", "LowParseWriters.NoHoare.lift_read_conv", "LowParseWriters.NoHoare.repr" ]
[]
false
false
false
false
false
let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) =
reify_trivial (lift_read_conv a inv r f_read_spec)
false
Steel.ST.MonotonicReference.fsti
Steel.ST.MonotonicReference.property
val property : a: Type -> Type
let property (a:Type) = a -> prop
{ "file_name": "lib/steel/Steel.ST.MonotonicReference.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 13, "end_line": 64, "start_col": 0, "start_line": 63 }
(* Copyright 2020 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Steel.ST.MonotonicReference open FStar.Ghost open Steel.ST.Util module Preorder = FStar.Preorder /// A library for references that are monotonic with respect to a /// user-specified preorder, with ownership controlled using /// fractional permissions. /// /// This library builds on top of Steel.MonotonicReference, providing /// a version of it for the ST effect. /// /// Its main feature is that it allows "witnessing" the value of a /// reference and later "recalling" that the current value is related /// to the prior witnessed value by the preorder. /// An abstract datatype for monotonic references /// where [p] constrains how the contents of the reference is allowed to evolve val ref (a:Type u#0) (p:Preorder.preorder a) : Type u#0 /// The main representation predicate val pts_to (#a:Type) (#p:Preorder.preorder a) (r:ref a p) ([@@@smt_fallback]f:perm) ([@@@smt_fallback]v:a) : vprop /// Allocates a reference with value [x]. We have full permission on the newly /// allocated reference. val alloc (#a:Type) (p:Preorder.preorder a) (v:a) : STT (ref a p) emp (fun r -> pts_to r full_perm v) /// Writes value [x] in the reference [r], as long as we have full /// ownership of [r], and, importantly, if the new value [x] is /// related to the old value by [p]. val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a) (r:ref a p) (x:a) : ST unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires p v x) (ensures fun _ -> True)
{ "checked_file": "/", "dependencies": [ "Steel.ST.Util.fsti.checked", "prims.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Steel.ST.MonotonicReference.fsti" }
[ { "abbrev": true, "full_module": "Steel.MonotonicReference", "short_module": "MR" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.ST.Coercions", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.ST.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "Prims.prop" ]
[]
false
false
false
true
true
let property (a: Type) =
a -> prop
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.subcomp
val subcomp (a: Type) ([@@@ refl_implicit]r_in_f r_out_f: parser) (l_f: memory_invariant) ([@@@ refl_implicit]r_in_g r_out_g: parser) (l_g: memory_invariant) ([@@@ refl_implicit]pr: squash (r_in_f == r_in_g)) (f_subcomp: repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires (l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g)) (ensures (fun _ -> True))
val subcomp (a: Type) ([@@@ refl_implicit]r_in_f r_out_f: parser) (l_f: memory_invariant) ([@@@ refl_implicit]r_in_g r_out_g: parser) (l_g: memory_invariant) ([@@@ refl_implicit]pr: squash (r_in_f == r_in_g)) (f_subcomp: repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires (l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g)) (ensures (fun _ -> True))
let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 85, "end_line": 407, "start_col": 0, "start_line": 391 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> r_in_f: LowParseWriters.LowParse.parser -> r_out_f: LowParseWriters.LowParse.parser -> l_f: LowParseWriters.memory_invariant -> r_in_g: LowParseWriters.LowParse.parser -> r_out_g: LowParseWriters.LowParse.parser -> l_g: LowParseWriters.memory_invariant -> pr: Prims.squash (r_in_f == r_in_g) -> f_subcomp: LowParseWriters.NoHoare.repr a r_in_f r_out_f l_f -> Prims.Pure (LowParseWriters.NoHoare.repr a r_in_g r_out_g l_g)
Prims.Pure
[]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.squash", "Prims.eq2", "LowParseWriters.NoHoare.repr", "LowParseWriters.NoHoare.subcomp2", "LowParseWriters.NoHoare.subcomp1", "Prims.l_and", "LowParseWriters.memory_invariant_includes", "LowParseWriters.NoHoare.valid_rewrite_prop", "Prims.l_True" ]
[]
false
false
false
false
false
let subcomp (a: Type) ([@@@ refl_implicit]r_in_f r_out_f: parser) (l_f: memory_invariant) ([@@@ refl_implicit]r_in_g r_out_g: parser) (l_g: memory_invariant) ([@@@ refl_implicit]pr: squash (r_in_f == r_in_g)) (f_subcomp: repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires (l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g)) (ensures (fun _ -> True)) =
subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.subcomp_conv
val subcomp_conv: a: Type -> r_in: parser -> r_out: parser -> l: memory_invariant -> l': memory_invariant -> f_subcomp: repr a r_in r_out l -> sq: squash (l `memory_invariant_includes` l') -> Prims.unit -> EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l'
val subcomp_conv: a: Type -> r_in: parser -> r_out: parser -> l: memory_invariant -> l': memory_invariant -> f_subcomp: repr a r_in r_out l -> sq: squash (l `memory_invariant_includes` l') -> Prims.unit -> EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l'
let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 359, "start_col": 0, "start_line": 347 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> r_in: LowParseWriters.LowParse.parser -> r_out: LowParseWriters.LowParse.parser -> l: LowParseWriters.memory_invariant -> l': LowParseWriters.memory_invariant -> f_subcomp: LowParseWriters.NoHoare.repr a r_in r_out l -> sq: Prims.squash (LowParseWriters.memory_invariant_includes l l') -> _: Prims.unit -> LowParseWriters.EWrite a
LowParseWriters.EWrite
[]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "LowParseWriters.NoHoare.repr", "Prims.squash", "LowParseWriters.memory_invariant_includes", "Prims.unit", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True" ]
[]
false
true
false
false
false
let subcomp_conv (a: Type) (r_in: parser) (r_out: parser) (l: memory_invariant) (l': memory_invariant) (f_subcomp: repr a r_in r_out l) (sq: squash (l `memory_invariant_includes` l')) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' =
let x = EWrite?.reflect f_subcomp in x
false
Steel.ST.MonotonicReference.fsti
Steel.ST.MonotonicReference.stable_property
val stable_property : p: FStar.Preorder.preorder a -> Type
let stable_property (#a:Type) (p:Preorder.preorder a) = fact:property a { Preorder.stable fact p }
{ "file_name": "lib/steel/Steel.ST.MonotonicReference.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 46, "end_line": 74, "start_col": 0, "start_line": 73 }
(* Copyright 2020 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Steel.ST.MonotonicReference open FStar.Ghost open Steel.ST.Util module Preorder = FStar.Preorder /// A library for references that are monotonic with respect to a /// user-specified preorder, with ownership controlled using /// fractional permissions. /// /// This library builds on top of Steel.MonotonicReference, providing /// a version of it for the ST effect. /// /// Its main feature is that it allows "witnessing" the value of a /// reference and later "recalling" that the current value is related /// to the prior witnessed value by the preorder. /// An abstract datatype for monotonic references /// where [p] constrains how the contents of the reference is allowed to evolve val ref (a:Type u#0) (p:Preorder.preorder a) : Type u#0 /// The main representation predicate val pts_to (#a:Type) (#p:Preorder.preorder a) (r:ref a p) ([@@@smt_fallback]f:perm) ([@@@smt_fallback]v:a) : vprop /// Allocates a reference with value [x]. We have full permission on the newly /// allocated reference. val alloc (#a:Type) (p:Preorder.preorder a) (v:a) : STT (ref a p) emp (fun r -> pts_to r full_perm v) /// Writes value [x] in the reference [r], as long as we have full /// ownership of [r], and, importantly, if the new value [x] is /// related to the old value by [p]. val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a) (r:ref a p) (x:a) : ST unit (pts_to r full_perm v) (fun v -> pts_to r full_perm x) (requires p v x) (ensures fun _ -> True) /// A wrapper around a predicate that depends on a value of type [a] let property (a:Type) = a -> prop /// A wrapper around a property [fact] that has been witnessed to be true and stable /// with respect to preorder [p] val witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a) : Type0 /// The type of properties depending on values of type [a], and that
{ "checked_file": "/", "dependencies": [ "Steel.ST.Util.fsti.checked", "prims.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Steel.ST.MonotonicReference.fsti" }
[ { "abbrev": true, "full_module": "Steel.MonotonicReference", "short_module": "MR" }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.ST.Coercions", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "FStar.Preorder", "short_module": "Preorder" }, { "abbrev": false, "full_module": "Steel.ST.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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.Preorder.preorder a -> Type
Prims.Tot
[ "total" ]
[]
[ "FStar.Preorder.preorder", "Steel.ST.MonotonicReference.property", "FStar.Preorder.stable" ]
[]
false
false
false
true
true
let stable_property (#a: Type) (p: Preorder.preorder a) =
fact: property a {Preorder.stable fact p}
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.wrap_extracted_impl
val wrap_extracted_impl (#a: Type u#x) (#r_in #r_out: parser) (l: memory_invariant) (f_destr_spec: (unit -> TWrite a r_in r_out l)) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l
val wrap_extracted_impl (#a: Type u#x) (#r_in #r_out: parser) (l: memory_invariant) (f_destr_spec: (unit -> TWrite a r_in r_out l)) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l
let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) ))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 4, "end_line": 540, "start_col": 0, "start_line": 529 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: LowParseWriters.memory_invariant -> f_destr_spec: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> e: LowParseWriters.NoHoare.extract_t l f_destr_spec -> LowParseWriters.NoHoare.TWrite a
LowParseWriters.NoHoare.TWrite
[]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.unit", "LowParseWriters.NoHoare.extract_t", "LowParseWriters.Repr", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.NoHoare.destr_repr_spec", "LowParseWriters.mk_repr_impl", "LowStar.Buffer.buffer", "LowParseWriters.LowParse.u8", "LowStar.Monotonic.Buffer.loc_includes", "FStar.Ghost.reveal", "LowStar.Monotonic.Buffer.loc", "LowParseWriters.__proj__Mkmemory_invariant__item__lwrite", "LowStar.Monotonic.Buffer.loc_buffer", "LowStar.Buffer.trivial_preorder", "FStar.UInt32.t", "Prims.eq2", "LowStar.Monotonic.Buffer.len", "LowParseWriters.buffer_offset", "LowParseWriters.iresult" ]
[]
false
true
false
false
false
let wrap_extracted_impl (#a: Type u#x) (#r_in #r_out: parser) (l: memory_invariant) (f_destr_spec: (unit -> TWrite a r_in r_out l)) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l =
TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) (mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1)))
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.bind_spec2_aux
val bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: (a -> repr b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3))
val bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: (a -> repr b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3))
let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 44, "end_line": 566, "start_col": 0, "start_line": 555 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
inv: LowParseWriters.memory_invariant -> p1: LowParseWriters.LowParse.parser -> p2: LowParseWriters.LowParse.parser -> p3: LowParseWriters.LowParse.parser -> a: Type -> b: Type -> $f: LowParseWriters.NoHoare.repr a p1 p2 inv -> $g: (_: a -> LowParseWriters.NoHoare.repr b p2 p3 inv) -> v1: Parser?.t p1 -> Prims.GTot (LowParseWriters.result (b * Parser?.t p3))
Prims.GTot
[ "sometrivial" ]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "LowParseWriters.NoHoare.repr", "LowParseWriters.LowParse.__proj__Parser__item__t", "LowParseWriters.__proj__Repr__item__spec", "Prims.l_True", "Prims.string", "LowParseWriters.Error", "FStar.Pervasives.Native.tuple2", "LowParseWriters.result" ]
[]
false
false
false
false
false
let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: (a -> repr b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) =
match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2
false
OPLSS.Log.fst
OPLSS.Log.not_found
val not_found : l: FStar.Seq.Base.seq a -> f: (_: a -> Prims.bool) -> Prims.logical
let not_found (#a:eqtype) (l:seq a) (f:a -> bool) = forall (x:a). x `Seq.mem` l ==> not (f x)
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 45, "end_line": 120, "start_col": 0, "start_line": 119 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in () let intro_contains_h #a (i:nat) (x:t a) (v:a) (h:HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) = Seq.contains_intro (HS.sel h x) i v let snoc_grows_contains #a (hd:a) (tl:seq a) : Lemma (tl `grows` snoc tl hd /\ index (snoc tl hd) (length tl) == hd) = () let contains #a (x:t a) (v:a) = token_p x (contains_h x v) let contains_now #a (x:t a) (v:a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1) = recall_p x (x `contains_h` v) assume val token_functoriality //demo scaffolding, should be in stdlib (#a:_) (#pre:_) (x:HST.mreference a pre) (p:mem_predicate{token_p x p}) (q:mem_predicate{(forall (h:mem). p h ==> q h)}) : Lemma (ensures token_p x q) let contains_now_e #a (x:t a) (refine: a -> Type) : ST unit (requires fun _ -> exists (v:a{refine v}). x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ (exists (v:a{refine v}). entries x h1 `has` v)) = let u : squash (exists (v:a{refine v}). x `contains` v) = () in FStar.Classical.exists_elim (token_p x (fun h -> exists (v:a{refine v}). contains_h x v h)) u (fun v -> token_functoriality x (contains_h x v) (fun h -> exists (v:a{refine v}). contains_h x v h)); recall_p x (fun h -> exists (v:a{refine v}). contains_h x v h) let new_log #a : ST (t a) (requires fun _ -> True) (ensures fun h0 x h1 -> HS.contains h1 x /\ HS.sel h1 x == Seq.empty /\ B.fresh_loc (B.loc_mreference x) h0 h1 /\ HST.ralloc_post HS.root Seq.empty h0 x h1) = ralloc HS.root Seq.empty let add #a (x:t a) (v:a) : ST unit (requires fun _ -> True) (ensures fun h0 _ h1 -> x `contains` v /\ entries x h1 `has` v /\ HS.sel h1 x == Seq.snoc (HS.sel h0 x) v /\ B.modifies (B.loc_mreference x) h0 h1) = let l0 = !x in x := Seq.snoc l0 v; let h = get () in intro_contains_h (Seq.length l0) x v h; assert (contains_h x v h); contains_h_stable x v; witness_p x (x `contains_h` v)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: FStar.Seq.Base.seq a -> f: (_: a -> Prims.bool) -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Prims.eqtype", "FStar.Seq.Base.seq", "Prims.bool", "Prims.l_Forall", "Prims.l_imp", "Prims.b2t", "FStar.Seq.Properties.mem", "Prims.op_Negation", "Prims.logical" ]
[]
false
false
false
false
true
let not_found (#a: eqtype) (l: seq a) (f: (a -> bool)) =
forall (x: a). x `Seq.mem` l ==> not (f x)
false
OPLSS.Log.fst
OPLSS.Log.intro_contains_h
val intro_contains_h (#a: _) (i: nat) (x: t a) (v: a) (h: HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h)
val intro_contains_h (#a: _) (i: nat) (x: t a) (v: a) (h: HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h)
let intro_contains_h #a (i:nat) (x:t a) (v:a) (h:HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) = Seq.contains_intro (HS.sel h x) i v
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 39, "end_line": 52, "start_col": 0, "start_line": 47 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
i: Prims.nat -> x: OPLSS.Log.t a -> v: a -> h: FStar.Monotonic.HyperStack.mem -> FStar.Pervasives.Lemma (requires i < FStar.Seq.Base.length (FStar.Monotonic.HyperStack.sel h x) /\ FStar.Seq.Base.index (FStar.Monotonic.HyperStack.sel h x) i == v) (ensures OPLSS.Log.contains_h x v h)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.eqtype", "Prims.nat", "OPLSS.Log.t", "FStar.Monotonic.HyperStack.mem", "FStar.Seq.Properties.contains_intro", "FStar.Monotonic.HyperStack.sel", "FStar.Seq.Base.seq", "OPLSS.Log.grows", "Prims.unit", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "FStar.Seq.Base.length", "Prims.eq2", "FStar.Seq.Base.index", "Prims.squash", "OPLSS.Log.contains_h", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let intro_contains_h #a (i: nat) (x: t a) (v: a) (h: HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) =
Seq.contains_intro (HS.sel h x) i v
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.bind_spec'
val bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3))
val bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3))
let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 553, "start_col": 0, "start_line": 542 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
inv: LowParseWriters.memory_invariant -> p1: LowParseWriters.LowParse.parser -> p2: LowParseWriters.LowParse.parser -> p3: LowParseWriters.LowParse.parser -> a: Type -> b: Type -> f: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> g: (_: a -> _: Prims.unit -> LowParseWriters.NoHoare.TWrite b) -> v1: Parser?.t p1 -> Prims.GTot (LowParseWriters.result (b * Parser?.t p3))
Prims.GTot
[ "sometrivial" ]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "Prims.unit", "LowParseWriters.LowParse.__proj__Parser__item__t", "LowParseWriters.NoHoare.destr_repr_spec", "Prims.string", "LowParseWriters.Error", "FStar.Pervasives.Native.tuple2", "LowParseWriters.result" ]
[]
false
false
false
false
false
let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) =
match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2
false
OPLSS.Log.fst
OPLSS.Log.grows
val grows (#a: Type) : Preorder.preorder (seq a)
val grows (#a: Type) : Preorder.preorder (seq a)
let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i)
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 103, "end_line": 15, "start_col": 0, "start_line": 11 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.Preorder.preorder (FStar.Seq.Base.seq a)
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.seq", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Seq.Base.length", "Prims.l_Forall", "Prims.nat", "Prims.l_imp", "Prims.op_LessThan", "Prims.eq2", "FStar.Seq.Base.index", "Prims.logical", "FStar.Preorder.preorder" ]
[]
false
false
false
true
false
let grows (#a: Type) : Preorder.preorder (seq a) =
fun (s1: seq a) (s2: seq a) -> length s1 <= length s2 /\ (forall (i: nat). {:pattern (index s1 i)\/(index s2 i)} i < length s1 ==> index s1 i == index s2 i )
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.valid_rewrite_repr
val valid_rewrite_repr (#p1 #p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv)
val valid_rewrite_repr (#p1 #p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv)
let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 89, "end_line": 344, "start_col": 0, "start_line": 338 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
v: Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p2) -> LowParseWriters.NoHoare.repr Prims.unit p1 p2 inv
Prims.Tot
[ "total" ]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop", "LowParseWriters.NoHoare.reify_trivial", "Prims.unit", "LowParseWriters.valid_rewrite", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite_f", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite", "LowParseWriters.NoHoare.repr" ]
[]
false
false
false
false
false
let valid_rewrite_repr (#p1 #p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) =
reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v))
false
OPLSS.Log.fst
OPLSS.Log.contains
val contains : x: OPLSS.Log.t a -> v: a -> Type0
let contains #a (x:t a) (v:a) = token_p x (contains_h x v)
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 59, "start_col": 0, "start_line": 58 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in () let intro_contains_h #a (i:nat) (x:t a) (v:a) (h:HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) = Seq.contains_intro (HS.sel h x) i v let snoc_grows_contains #a (hd:a) (tl:seq a) : Lemma (tl `grows` snoc tl hd /\ index (snoc tl hd) (length tl) == hd) = ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: OPLSS.Log.t a -> v: a -> Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.eqtype", "OPLSS.Log.t", "FStar.HyperStack.ST.token_p", "FStar.Seq.Base.seq", "OPLSS.Log.grows", "OPLSS.Log.contains_h" ]
[]
false
false
false
false
true
let contains #a (x: t a) (v: a) =
token_p x (contains_h x v)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.twrite_of_ewrite
val twrite_of_ewrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : TWrite a p1 p2 l
val twrite_of_ewrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : TWrite a p1 p2 l
let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 35, "end_line": 595, "start_col": 0, "start_line": 589 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
f: (_: Prims.unit -> LowParseWriters.EWrite a) -> LowParseWriters.NoHoare.TWrite a
LowParseWriters.NoHoare.TWrite
[]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "Prims.unit", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.NoHoare.reify_trivial" ]
[]
false
true
false
false
false
let twrite_of_ewrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : TWrite a p1 p2 l =
TWrite?.reflect (reify_trivial f)
false
Steel.ST.SeqMatch.fst
Steel.ST.SeqMatch.seq_seq_match_item_match_option_upd
val seq_seq_match_item_match_option_upd (#opened: _) (#t1 #t2: Type) (p: (t1 -> t2 -> vprop)) (s1: Seq.seq t1) (s2: Seq.seq (option t2)) (i j: nat) (k: nat{i <= j /\ j < k}) (x1: t1) (x2: t2) : STGhostT (squash (j < Seq.length s1 /\ j < Seq.length s2)) opened ((seq_seq_match (item_match_option p) s1 s2 i k) `star` (p x1 x2)) (fun _ -> seq_seq_match (item_match_option p) (Seq.upd s1 j x1) (Seq.upd s2 j (Some x2)) i k)
val seq_seq_match_item_match_option_upd (#opened: _) (#t1 #t2: Type) (p: (t1 -> t2 -> vprop)) (s1: Seq.seq t1) (s2: Seq.seq (option t2)) (i j: nat) (k: nat{i <= j /\ j < k}) (x1: t1) (x2: t2) : STGhostT (squash (j < Seq.length s1 /\ j < Seq.length s2)) opened ((seq_seq_match (item_match_option p) s1 s2 i k) `star` (p x1 x2)) (fun _ -> seq_seq_match (item_match_option p) (Seq.upd s1 j x1) (Seq.upd s2 j (Some x2)) i k)
let seq_seq_match_item_match_option_upd (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (s1: Seq.seq t1) (s2: Seq.seq (option t2)) (i j: nat) (k: nat { i <= j /\ j < k }) (x1: t1) (x2: t2) : STGhostT (squash (j < Seq.length s1 /\ j < Seq.length s2)) opened (seq_seq_match (item_match_option p) s1 s2 i k `star` p x1 x2) (fun _ -> seq_seq_match (item_match_option p) (Seq.upd s1 j x1) (Seq.upd s2 j (Some x2)) i k ) = rewrite (p x1 x2) (item_match_option p x1 (Some x2)); seq_seq_match_upd (item_match_option p) s1 s2 i j k x1 (Some x2)
{ "file_name": "lib/steel/Steel.ST.SeqMatch.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 66, "end_line": 749, "start_col": 0, "start_line": 729 }
module Steel.ST.SeqMatch include Steel.ST.OnRange open Steel.ST.GenElim module Seq = FStar.Seq module SZ = FStar.SizeT (* `seq_list_match` describes how to match a sequence of low-level values (the low-level contents of an array) with a list of high-level values. `seq_list_match` is carefully designed to be usable within (mutually) recursive definitions of matching functions on the type of high-level values. *) [@@__reduce__] let seq_list_match_nil0 (#t: Type) (c: Seq.seq t) : Tot vprop = pure (c `Seq.equal` Seq.empty) [@@__reduce__] let seq_list_match_cons0 (#t #t': Type) (c: Seq.seq t) (l: list t' { Cons? l }) (item_match: (t -> (v': t' { v' << l }) -> vprop)) (seq_list_match: (Seq.seq t -> (v': list t') -> (raw_data_item_match: (t -> (v'': t' { v'' << v' }) -> vprop) { v' << l }) -> vprop)) : Tot vprop = exists_ (fun (c1: t) -> exists_ (fun (c2: Seq.seq t) -> item_match c1 (List.Tot.hd l) `star` seq_list_match c2 (List.Tot.tl l) item_match `star` pure (c `Seq.equal` Seq.cons c1 c2) )) let rec seq_list_match (#t #t': Type) (c: Seq.seq t) (v: list t') (item_match: (t -> (v': t' { v' << v }) -> vprop)) : Tot vprop (decreases v) = if Nil? v then seq_list_match_nil0 c else seq_list_match_cons0 c v item_match seq_list_match let seq_list_match_cons_eq (#t #t': Type) (c: Seq.seq t) (v: list t') (item_match: (t -> (v': t' { v' << v }) -> vprop)) : Lemma (requires (Cons? v)) (ensures ( seq_list_match c v item_match == seq_list_match_cons0 c v item_match seq_list_match )) = let a :: q = v in assert_norm (seq_list_match c (a :: q) item_match == seq_list_match_cons0 c (a :: q) item_match seq_list_match ) let seq_list_match_nil (#opened: _) (#t #t': Type) (c: Seq.seq t) (v: list t') (item_match: (t -> (v': t' { v' << v }) -> vprop)) : STGhost unit opened emp (fun _ -> seq_list_match c v item_match) (c `Seq.equal` Seq.empty /\ Nil? v) (fun _ -> True) = noop (); rewrite (seq_list_match_nil0 c) (seq_list_match c v item_match) let list_cons_precedes (#t: Type) (a: t) (q: list t) : Lemma ((a << a :: q) /\ (q << a :: q)) [SMTPat (a :: q)] = assert (List.Tot.hd (a :: q) << (a :: q)); assert (List.Tot.tl (a :: q) << (a :: q)) let seq_list_match_cons_intro (#opened: _) (#t #t': Type) (a: t) (a' : t') (c: Seq.seq t) (v: list t') (item_match: (t -> (v': t' { v' << a' :: v }) -> vprop)) : STGhostT unit opened (item_match a a' `star` seq_list_match c v item_match) (fun _ -> seq_list_match (Seq.cons a c) (a' :: v) item_match) = seq_list_match_cons_eq (Seq.cons a c) (a' :: v) item_match; noop (); rewrite (seq_list_match_cons0 (Seq.cons a c) (a' :: v) item_match seq_list_match) (seq_list_match (Seq.cons a c) (a' :: v) item_match) let seq_list_match_cons_elim (#opened: _) (#t #t': Type) (c: Seq.seq t) (v: list t' { Cons? v \/ Seq.length c > 0 }) (item_match: (t -> (v': t' { v' << v }) -> vprop)) : STGhostT (squash (Cons? v /\ Seq.length c > 0)) opened (seq_list_match c v item_match) (fun _ -> item_match (Seq.head c) (List.Tot.hd v) `star` seq_list_match (Seq.tail c) (List.Tot.tl v) item_match) = if Nil? v then begin rewrite (seq_list_match c v item_match) (seq_list_match_nil0 c); let _ = gen_elim () in assert False; rewrite // by contradiction emp (item_match (Seq.head c) (List.Tot.hd v) `star` seq_list_match (Seq.tail c) (List.Tot.tl v) item_match) end else begin seq_list_match_cons_eq c v item_match; noop (); rewrite (seq_list_match c v item_match) (seq_list_match_cons0 c v item_match seq_list_match); let _ = gen_elim () in let prf : squash (Cons? v /\ Seq.length c > 0) = () in let c1 = vpattern (fun c1 -> item_match c1 (List.Tot.hd v)) in let c2 = vpattern (fun c2 -> seq_list_match c2 (List.Tot.tl v) item_match) in Seq.lemma_cons_inj c1 (Seq.head c) c2 (Seq.tail c); vpattern_rewrite (fun c1 -> item_match c1 (List.Tot.hd v)) (Seq.head c); vpattern_rewrite (fun c2 -> seq_list_match c2 (List.Tot.tl v) item_match) (Seq.tail c); prf end // this one cannot be proven with seq_seq_match because of the << refinement in the type of item_match let rec seq_list_match_weaken (#opened: _) (#t #t': Type) (c: Seq.seq t) (v: list t') (item_match1 item_match2: (t -> (v': t' { v' << v }) -> vprop)) (prf: ( (#opened: _) -> (c': t) -> (v': t' { v' << v }) -> STGhostT unit opened (item_match1 c' v') (fun _ -> item_match2 c' v') )) : STGhostT unit opened (seq_list_match c v item_match1) (fun _ -> seq_list_match c v item_match2) (decreases v) = if Nil? v then rewrite (seq_list_match c v item_match1) (seq_list_match c v item_match2) else begin let _ : squash (Cons? v) = () in seq_list_match_cons_eq c v item_match1; seq_list_match_cons_eq c v item_match2; rewrite (seq_list_match c v item_match1) (seq_list_match_cons0 c v item_match1 seq_list_match); let _ = gen_elim () in prf _ _; seq_list_match_weaken _ (List.Tot.tl v) item_match1 item_match2 prf; rewrite (seq_list_match_cons0 c v item_match2 seq_list_match) (seq_list_match c v item_match2) end (* `seq_seq_match` describes how to match a sequence of low-level values (the low-level contents of an array) with a sequence of high-level values. Contrary to `seq_list_match`, `seq_seq_match` is not meant to be usable within (mutually) recursive definitions of matching functions on the type of high-level values, because no lemma ensures that `Seq.index s i << s` *) let seq_seq_match_item (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: Seq.seq t2) (i: nat) : Tot vprop = if i < Seq.length c && i < Seq.length l then p (Seq.index c i) (Seq.index l i) else pure (squash False) let seq_seq_match_item_tail (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: Seq.seq t2) (delta: nat) (i: nat) : Lemma (requires ( i + delta <= Seq.length c /\ i + delta <= Seq.length l )) (ensures ( seq_seq_match_item p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l)) i == seq_seq_match_item p c l (i + delta) )) = () [@@__reduce__] let seq_seq_match (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: Seq.seq t2) (i j: nat) : Tot vprop = on_range (seq_seq_match_item p c l) i j let seq_seq_match_length (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (s1: Seq.seq t1) (s2: Seq.seq t2) (i j: nat) : STGhost unit opened (seq_seq_match p s1 s2 i j) (fun _ -> seq_seq_match p s1 s2 i j) True (fun _ -> i <= j /\ (i == j \/ (j <= Seq.length s1 /\ j <= Seq.length s2))) = on_range_le (seq_seq_match_item p s1 s2) i j; if i = j then noop () else begin let j' = j - 1 in if j' < Seq.length s1 && j' < Seq.length s2 then noop () else begin on_range_unsnoc (seq_seq_match_item p s1 s2) i j' j; rewrite (seq_seq_match_item p _ _ _) (pure (squash False)); let _ = gen_elim () in rewrite (seq_seq_match p s1 s2 i j') (seq_seq_match p s1 s2 i j) // by contradiction end end let seq_seq_match_weaken (#opened: _) (#t1 #t2: Type) (p p': t1 -> t2 -> vprop) (w: ((x1: t1) -> (x2: t2) -> STGhostT unit opened (p x1 x2) (fun _ -> p' x1 x2) )) (c1 c1': Seq.seq t1) (c2 c2': Seq.seq t2) (i j: nat) : STGhost unit opened (seq_seq_match p c1 c2 i j) (fun _ -> seq_seq_match p' c1' c2' i j) (i <= j /\ (i == j \/ ( j <= Seq.length c1 /\ j <= Seq.length c2 /\ j <= Seq.length c1' /\ j <= Seq.length c2' /\ Seq.slice c1 i j `Seq.equal` Seq.slice c1' i j /\ Seq.slice c2 i j `Seq.equal` Seq.slice c2' i j ))) (fun _ -> True) = on_range_weaken (seq_seq_match_item p c1 c2) (seq_seq_match_item p' c1' c2') i j (fun k -> rewrite (seq_seq_match_item p c1 c2 k) (p (Seq.index (Seq.slice c1 i j) (k - i)) (Seq.index (Seq.slice c2 i j) (k - i))); w _ _; rewrite (p' _ _) (seq_seq_match_item p' c1' c2' k) ) let seq_seq_match_weaken_with_implies (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c1 c1': Seq.seq t1) (c2 c2': Seq.seq t2) (i j: nat) : STGhost unit opened (seq_seq_match p c1 c2 i j) (fun _ -> seq_seq_match p c1' c2' i j `star` (seq_seq_match p c1' c2' i j `implies_` seq_seq_match p c1 c2 i j) ) (i <= j /\ (i == j \/ ( j <= Seq.length c1 /\ j <= Seq.length c2 /\ j <= Seq.length c1' /\ j <= Seq.length c2' /\ Seq.slice c1 i j `Seq.equal` Seq.slice c1' i j /\ Seq.slice c2 i j `Seq.equal` Seq.slice c2' i j ))) (fun _ -> True) = seq_seq_match_weaken p p (fun _ _ -> noop ()) c1 c1' c2 c2' i j; intro_implies (seq_seq_match p c1' c2' i j) (seq_seq_match p c1 c2 i j) emp (fun _ -> seq_seq_match_weaken p p (fun _ _ -> noop ()) c1' c1 c2' c2 i j ) (* Going between `seq_list_match` and `seq_seq_match` *) let seq_seq_match_tail_elim (#t1 #t2: Type) (#opened: _) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: Seq.seq (t2)) (delta: nat { delta <= Seq.length c /\ delta <= Seq.length l }) (i j: nat) : STGhostT unit opened (seq_seq_match p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l)) i j) (fun _ -> seq_seq_match p c l (i + delta) (j + delta)) = on_range_le (seq_seq_match_item p _ _) _ _; on_range_weaken_and_shift (seq_seq_match_item p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l))) (seq_seq_match_item p c l) delta i j (fun k -> if k < Seq.length c - delta && k < Seq.length l - delta then begin seq_seq_match_item_tail p c l delta k; rewrite (seq_seq_match_item p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l)) k) (seq_seq_match_item p c l (k + delta)) end else begin rewrite (seq_seq_match_item p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l)) k) (pure (squash False)); let _ = gen_elim () in rewrite emp (seq_seq_match_item p c l (k + delta)) // by contradiction end ) (i + delta) (j + delta) let seq_seq_match_tail_intro (#t1 #t2: Type) (#opened: _) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: Seq.seq t2) (delta: nat { delta <= Seq.length c /\ delta <= Seq.length l }) (i: nat { delta <= i }) (j: nat) : STGhostT (squash (i <= j)) opened (seq_seq_match p c l i j) (fun _ -> seq_seq_match p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l)) (i - delta) (j - delta)) = on_range_le (seq_seq_match_item p _ _) _ _; on_range_weaken_and_shift (seq_seq_match_item p c l) (seq_seq_match_item p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l))) (0 - delta) i j (fun k -> if k < Seq.length c && k < Seq.length l then begin seq_seq_match_item_tail p c l delta (k - delta); rewrite (seq_seq_match_item p c l k) (seq_seq_match_item p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l)) (k + (0 - delta))) end else begin rewrite (seq_seq_match_item p c l k) (pure (squash False)); let _ = gen_elim () in rewrite emp (seq_seq_match_item p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l)) (k + (0 - delta))) // by contradiction end ) (i - delta) (j - delta) let rec seq_seq_match_seq_list_match (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: list t2) : STGhost unit opened (seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l)) (fun _ -> seq_list_match c l p) (Seq.length c == List.Tot.length l) (fun _ -> True) (decreases l) = match l with | [] -> drop (seq_seq_match p _ _ _ _); rewrite (seq_list_match_nil0 c) (seq_list_match c l p) | a :: q -> Seq.lemma_seq_of_list_induction (a :: q); seq_list_match_cons_eq c l p; on_range_uncons (seq_seq_match_item p _ _) _ 1 _; rewrite (seq_seq_match_item p _ _ _) (p (Seq.head c) (List.Tot.hd l)); let _ = seq_seq_match_tail_intro p _ _ 1 _ _ in rewrite (seq_seq_match p _ _ _ _) (seq_seq_match p (Seq.tail c) (Seq.seq_of_list (List.Tot.tl l)) 0 (List.Tot.length (List.Tot.tl l))); seq_seq_match_seq_list_match p _ (List.Tot.tl l); rewrite (seq_list_match_cons0 c l p seq_list_match) (seq_list_match c l p) let rec seq_list_match_seq_seq_match (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: list t2) : STGhost unit opened (seq_list_match c l p) (fun _ -> seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l)) True (fun _ -> Seq.length c == List.Tot.length l) (decreases l) = match l with | [] -> rewrite (seq_list_match c l p) (seq_list_match_nil0 c); let _ = gen_elim () in on_range_empty (seq_seq_match_item p c (Seq.seq_of_list l)) 0 (List.Tot.length l) | a :: q -> let _l_nonempty : squash (Cons? l) = () in Seq.lemma_seq_of_list_induction (a :: q); seq_list_match_cons_eq c l p; noop (); rewrite (seq_list_match c l p) (seq_list_match_cons0 c l p seq_list_match); let _ = gen_elim () in let a' = vpattern (fun a' -> p a' _) in let c' = vpattern (fun c' -> seq_list_match c' _ _) in Seq.lemma_cons_inj (Seq.head c) a' (Seq.tail c) c'; assert (a' == Seq.head c); assert (c' == Seq.tail c); noop (); seq_list_match_seq_seq_match p _ _; rewrite (seq_seq_match p _ _ _ _) (seq_seq_match p (Seq.slice c 1 (Seq.length c)) (Seq.slice (Seq.seq_of_list l) 1 (Seq.length (Seq.seq_of_list l))) 0 (List.Tot.length (List.Tot.tl l))); let _ = seq_seq_match_tail_elim p c (Seq.seq_of_list l) 1 0 (List.Tot.length (List.Tot.tl l)) in rewrite (seq_seq_match p _ _ _ _) (seq_seq_match p c (Seq.seq_of_list l) 1 (List.Tot.length l)); rewrite (p _ _) (seq_seq_match_item p c (Seq.seq_of_list l) 0); on_range_cons (seq_seq_match_item p _ _) 0 1 (List.Tot.length l) let seq_seq_match_seq_list_match_with_implies (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: list t2) : STGhost unit opened (seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l)) (fun _ -> seq_list_match c l p `star` (seq_list_match c l p `implies_` seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l))) (Seq.length c == List.Tot.length l) (fun _ -> True) = seq_seq_match_seq_list_match p c l; intro_implies (seq_list_match c l p) (seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l)) emp (fun _ -> seq_list_match_seq_seq_match p c l) let seq_list_match_seq_seq_match_with_implies (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: list t2) : STGhost unit opened (seq_list_match c l p) (fun _ -> seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l) `star` (seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l) `implies_` seq_list_match c l p)) True (fun _ -> Seq.length c == List.Tot.length l) = seq_list_match_seq_seq_match p c l; intro_implies (seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l)) (seq_list_match c l p) emp (fun _ -> seq_seq_match_seq_list_match p c l) let seq_list_match_length (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: list t2) : STGhost unit opened (seq_list_match c l p) (fun _ -> seq_list_match c l p) True (fun _ -> Seq.length c == List.Tot.length l) = seq_list_match_seq_seq_match_with_implies p c l; seq_seq_match_length p _ _ _ _; elim_implies (seq_seq_match p _ _ _ _) (seq_list_match c l p) let seq_list_match_index (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (s1: Seq.seq t1) (s2: list t2) (i: nat) : STGhost (squash (i < Seq.length s1 /\ List.Tot.length s2 == Seq.length s1)) opened (seq_list_match s1 s2 p) (fun _ -> p (Seq.index s1 i) (List.Tot.index s2 i) `star` (p (Seq.index s1 i) (List.Tot.index s2 i) `implies_` seq_list_match s1 s2 p) ) (i < Seq.length s1 \/ i < List.Tot.length s2) (fun _ -> True) = seq_list_match_seq_seq_match_with_implies p s1 s2; let res : squash (i < Seq.length s1 /\ List.Tot.length s2 == Seq.length s1) = () in on_range_focus (seq_seq_match_item p s1 (Seq.seq_of_list s2)) 0 i (List.Tot.length s2); rewrite_with_implies (seq_seq_match_item p _ _ _) (p (Seq.index s1 i) (List.Tot.index s2 i)); implies_trans (p (Seq.index s1 i) (List.Tot.index s2 i)) (seq_seq_match_item p _ _ _) (seq_seq_match p s1 (Seq.seq_of_list s2) 0 (List.Tot.length s2)); implies_trans (p (Seq.index s1 i) (List.Tot.index s2 i)) (seq_seq_match p s1 (Seq.seq_of_list s2) 0 (List.Tot.length s2)) (seq_list_match s1 s2 p); res (* Random array access Since `seq_list_match` is defined recursively on the list of high-level values, it is used naturally left-to-right. By contrast, in practice, an application may populate an array in a different order, or even out-of-order. `seq_seq_match` supports that scenario better, as we show below. *) let seq_map (#t1 #t2: Type) (f: t1 -> t2) (s: Seq.seq t1) : Tot (Seq.seq t2) = Seq.init (Seq.length s) (fun i -> f (Seq.index s i)) let item_match_option (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (x1: t1) (x2: option t2) : Tot vprop = match x2 with | None -> emp | Some x2' -> p x1 x2' let seq_seq_match_item_match_option_elim (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (s1: Seq.seq t1) (s2: Seq.seq t2) (i j: nat) : STGhostT unit opened (seq_seq_match (item_match_option p) s1 (seq_map Some s2) i j) (fun _ -> seq_seq_match p s1 s2 i j) = on_range_weaken (seq_seq_match_item (item_match_option p) s1 (seq_map Some s2)) (seq_seq_match_item p s1 s2) i j (fun k -> rewrite (seq_seq_match_item (item_match_option p) s1 (seq_map Some s2) k) (seq_seq_match_item p s1 s2 k) ) let seq_seq_match_item_match_option_intro (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (s1: Seq.seq t1) (s2: Seq.seq t2) (i j: nat) : STGhostT unit opened (seq_seq_match p s1 s2 i j) (fun _ -> seq_seq_match (item_match_option p) s1 (seq_map Some s2) i j) = on_range_weaken (seq_seq_match_item p s1 s2) (seq_seq_match_item (item_match_option p) s1 (seq_map Some s2)) i j (fun k -> rewrite (seq_seq_match_item p s1 s2 k) (seq_seq_match_item (item_match_option p) s1 (seq_map Some s2) k) ) let rec seq_seq_match_item_match_option_init (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (s: Seq.seq t1) : STGhostT unit opened emp (fun _ -> seq_seq_match (item_match_option p) s (Seq.create (Seq.length s) None) 0 (Seq.length s)) (decreases (Seq.length s)) = if Seq.length s = 0 then on_range_empty (seq_seq_match_item (item_match_option p) s (Seq.create (Seq.length s) None)) 0 (Seq.length s) else begin seq_seq_match_item_match_option_init p (Seq.tail s); on_range_weaken_and_shift (seq_seq_match_item (item_match_option p) (Seq.tail s) (Seq.create (Seq.length (Seq.tail s)) None)) (seq_seq_match_item (item_match_option p) s (Seq.create (Seq.length s) None)) 1 0 (Seq.length (Seq.tail s)) (fun k -> rewrite (seq_seq_match_item (item_match_option p) (Seq.tail s) (Seq.create (Seq.length (Seq.tail s)) None) k) (seq_seq_match_item (item_match_option p) s (Seq.create (Seq.length s) None) (k + 1)) ) 1 (Seq.length s); rewrite emp (seq_seq_match_item (item_match_option p) s (Seq.create (Seq.length s) None) 0); on_range_cons (seq_seq_match_item (item_match_option p) s (Seq.create (Seq.length s) None)) 0 1 (Seq.length s) end let seq_seq_match_upd (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (s1: Seq.seq t1) (s2: Seq.seq t2) (i j: nat) (k: nat { i <= j /\ j < k }) (x1: t1) (x2: t2) : STGhostT (squash (j < Seq.length s1 /\ j < Seq.length s2)) opened (seq_seq_match p s1 s2 i k `star` p x1 x2) (fun _ -> seq_seq_match p (Seq.upd s1 j x1) (Seq.upd s2 j x2) i k ) = seq_seq_match_length p s1 s2 i k; on_range_get (seq_seq_match_item p s1 s2) i j (j + 1) k; let res : squash (j < Seq.length s1 /\ j < Seq.length s2) = () in drop (seq_seq_match_item p s1 s2 j); rewrite (p x1 x2) (seq_seq_match_item p (Seq.upd s1 j x1) (Seq.upd s2 j x2) j); seq_seq_match_weaken p p (fun _ _ -> noop ()) s1 (Seq.upd s1 j x1) s2 (Seq.upd s2 j x2) i j; seq_seq_match_weaken p p (fun _ _ -> noop ()) s1 (Seq.upd s1 j x1) s2 (Seq.upd s2 j x2) (j + 1) k; on_range_put (seq_seq_match_item p (Seq.upd s1 j x1) (Seq.upd s2 j x2)) i j j (j + 1) k; res
{ "checked_file": "/", "dependencies": [ "Steel.ST.OnRange.fsti.checked", "Steel.ST.GenElim.fsti.checked", "prims.fst.checked", "FStar.SizeT.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Steel.ST.SeqMatch.fst" }
[ { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "SZ" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": false, "full_module": "Steel.ST.GenElim", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST.OnRange", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: (_: t1 -> _: t2 -> Steel.Effect.Common.vprop) -> s1: FStar.Seq.Base.seq t1 -> s2: FStar.Seq.Base.seq (FStar.Pervasives.Native.option t2) -> i: Prims.nat -> j: Prims.nat -> k: Prims.nat{i <= j /\ j < k} -> x1: t1 -> x2: t2 -> Steel.ST.Effect.Ghost.STGhostT (Prims.squash (j < FStar.Seq.Base.length s1 /\ j < FStar.Seq.Base.length s2))
Steel.ST.Effect.Ghost.STGhostT
[]
[]
[ "Steel.Memory.inames", "Steel.Effect.Common.vprop", "FStar.Seq.Base.seq", "FStar.Pervasives.Native.option", "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Steel.ST.SeqMatch.seq_seq_match_upd", "Steel.ST.SeqMatch.item_match_option", "FStar.Pervasives.Native.Some", "Prims.squash", "FStar.Seq.Base.length", "Prims.unit", "Steel.ST.Util.rewrite", "Steel.Effect.Common.star", "Steel.ST.SeqMatch.seq_seq_match", "FStar.Seq.Base.upd" ]
[]
false
true
true
false
false
let seq_seq_match_item_match_option_upd (#opened: _) (#t1 #t2: Type) (p: (t1 -> t2 -> vprop)) (s1: Seq.seq t1) (s2: Seq.seq (option t2)) (i j: nat) (k: nat{i <= j /\ j < k}) (x1: t1) (x2: t2) : STGhostT (squash (j < Seq.length s1 /\ j < Seq.length s2)) opened ((seq_seq_match (item_match_option p) s1 s2 i k) `star` (p x1 x2)) (fun _ -> seq_seq_match (item_match_option p) (Seq.upd s1 j x1) (Seq.upd s2 j (Some x2)) i k) =
rewrite (p x1 x2) (item_match_option p x1 (Some x2)); seq_seq_match_upd (item_match_option p) s1 s2 i j k x1 (Some x2)
false
OPLSS.Log.fst
OPLSS.Log.contains_h_stable
val contains_h_stable (#a: _) (x: t a) (v: a) : Lemma ((x `contains_h` v) `stable_on` x)
val contains_h_stable (#a: _) (x: t a) (v: a) : Lemma ((x `contains_h` v) `stable_on` x)
let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in ()
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 45, "start_col": 0, "start_line": 28 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: OPLSS.Log.t a -> v: a -> FStar.Pervasives.Lemma (ensures FStar.HyperStack.ST.stable_on (OPLSS.Log.contains_h x v) x)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.eqtype", "OPLSS.Log.t", "FStar.Monotonic.HyperStack.mem", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.l_imp", "Prims.l_and", "OPLSS.Log.contains_h", "OPLSS.Log.grows", "FStar.Monotonic.HyperStack.sel", "FStar.Seq.Base.seq", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil", "FStar.Classical.move_requires", "Prims.b2t", "FStar.Seq.Properties.mem", "Prims.l_Exists", "Prims.nat", "Prims.op_LessThan", "FStar.Seq.Base.length", "Prims.eq2", "FStar.Seq.Base.index", "FStar.Seq.Properties.mem_index", "Prims.bool", "FStar.HyperStack.ST.stable_on" ]
[]
false
false
true
false
false
let contains_h_stable #a (x: t a) (v: a) : Lemma ((x `contains_h` v) `stable_on` x) =
let aux (h0 h1: HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s: seq a) (x: a) (k: nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in ()
false
OPLSS.Log.fst
OPLSS.Log.contains_now_e
val contains_now_e (#a: _) (x: t a) (refine: (a -> Type)) : ST unit (requires fun _ -> exists (v: a{refine v}). x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ (exists (v: a{refine v}). (entries x h1) `has` v))
val contains_now_e (#a: _) (x: t a) (refine: (a -> Type)) : ST unit (requires fun _ -> exists (v: a{refine v}). x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ (exists (v: a{refine v}). (entries x h1) `has` v))
let contains_now_e #a (x:t a) (refine: a -> Type) : ST unit (requires fun _ -> exists (v:a{refine v}). x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ (exists (v:a{refine v}). entries x h1 `has` v)) = let u : squash (exists (v:a{refine v}). x `contains` v) = () in FStar.Classical.exists_elim (token_p x (fun h -> exists (v:a{refine v}). contains_h x v h)) u (fun v -> token_functoriality x (contains_h x v) (fun h -> exists (v:a{refine v}). contains_h x v h)); recall_p x (fun h -> exists (v:a{refine v}). contains_h x v h)
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 66, "end_line": 91, "start_col": 0, "start_line": 77 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in () let intro_contains_h #a (i:nat) (x:t a) (v:a) (h:HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) = Seq.contains_intro (HS.sel h x) i v let snoc_grows_contains #a (hd:a) (tl:seq a) : Lemma (tl `grows` snoc tl hd /\ index (snoc tl hd) (length tl) == hd) = () let contains #a (x:t a) (v:a) = token_p x (contains_h x v) let contains_now #a (x:t a) (v:a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1) = recall_p x (x `contains_h` v) assume val token_functoriality //demo scaffolding, should be in stdlib (#a:_) (#pre:_) (x:HST.mreference a pre) (p:mem_predicate{token_p x p}) (q:mem_predicate{(forall (h:mem). p h ==> q h)}) : Lemma (ensures token_p x q)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: OPLSS.Log.t a -> refine: (_: a -> Type) -> FStar.HyperStack.ST.ST Prims.unit
FStar.HyperStack.ST.ST
[]
[]
[ "Prims.eqtype", "OPLSS.Log.t", "FStar.HyperStack.ST.recall_p", "FStar.Seq.Base.seq", "OPLSS.Log.grows", "FStar.Monotonic.HyperStack.mem", "Prims.l_Exists", "OPLSS.Log.contains_h", "Prims.unit", "FStar.Classical.exists_elim", "FStar.HyperStack.ST.token_p", "OPLSS.Log.contains", "OPLSS.Log.token_functoriality", "Prims.squash", "Prims.l_and", "Prims.eq2", "Prims.b2t", "OPLSS.Log.has", "OPLSS.Log.entries" ]
[]
false
true
false
false
false
let contains_now_e #a (x: t a) (refine: (a -> Type)) : ST unit (requires fun _ -> exists (v: a{refine v}). x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ (exists (v: a{refine v}). (entries x h1) `has` v)) =
let u:squash (exists (v: a{refine v}). x `contains` v) = () in FStar.Classical.exists_elim (token_p x (fun h -> exists (v: a{refine v}). contains_h x v h)) u (fun v -> token_functoriality x (contains_h x v) (fun h -> exists (v: a{refine v}). contains_h x v h)); recall_p x (fun h -> exists (v: a{refine v}). contains_h x v h)
false
OPLSS.Log.fst
OPLSS.Log.contains_now
val contains_now (#a: _) (x: t a) (v: a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1)
val contains_now (#a: _) (x: t a) (v: a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1)
let contains_now #a (x:t a) (v:a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1) = recall_p x (x `contains_h` v)
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 33, "end_line": 68, "start_col": 0, "start_line": 61 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in () let intro_contains_h #a (i:nat) (x:t a) (v:a) (h:HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) = Seq.contains_intro (HS.sel h x) i v let snoc_grows_contains #a (hd:a) (tl:seq a) : Lemma (tl `grows` snoc tl hd /\ index (snoc tl hd) (length tl) == hd) = () let contains #a (x:t a) (v:a) = token_p x (contains_h x v)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: OPLSS.Log.t a -> v: a -> FStar.HyperStack.ST.ST Prims.unit
FStar.HyperStack.ST.ST
[]
[]
[ "Prims.eqtype", "OPLSS.Log.t", "FStar.HyperStack.ST.recall_p", "FStar.Seq.Base.seq", "OPLSS.Log.grows", "OPLSS.Log.contains_h", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "OPLSS.Log.contains", "Prims.l_and", "Prims.eq2" ]
[]
false
true
false
false
false
let contains_now #a (x: t a) (v: a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1) =
recall_p x (x `contains_h` v)
false
OPLSS.Log.fst
OPLSS.Log.index_mem
val index_mem (#a: eqtype) (s: seq a) (x: a) : Lemma (ensures (Seq.mem x s <==> (exists i. Seq.index s i == x))) (decreases (Seq.length s))
val index_mem (#a: eqtype) (s: seq a) (x: a) : Lemma (ensures (Seq.mem x s <==> (exists i. Seq.index s i == x))) (decreases (Seq.length s))
let rec index_mem (#a:eqtype) (s:seq a) (x:a) : Lemma (ensures (Seq.mem x s <==> (exists i. Seq.index s i == x))) (decreases (Seq.length s)) = if length s = 0 then () else if head s = x then () else index_mem (tail s) x
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 31, "end_line": 127, "start_col": 0, "start_line": 122 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in () let intro_contains_h #a (i:nat) (x:t a) (v:a) (h:HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) = Seq.contains_intro (HS.sel h x) i v let snoc_grows_contains #a (hd:a) (tl:seq a) : Lemma (tl `grows` snoc tl hd /\ index (snoc tl hd) (length tl) == hd) = () let contains #a (x:t a) (v:a) = token_p x (contains_h x v) let contains_now #a (x:t a) (v:a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1) = recall_p x (x `contains_h` v) assume val token_functoriality //demo scaffolding, should be in stdlib (#a:_) (#pre:_) (x:HST.mreference a pre) (p:mem_predicate{token_p x p}) (q:mem_predicate{(forall (h:mem). p h ==> q h)}) : Lemma (ensures token_p x q) let contains_now_e #a (x:t a) (refine: a -> Type) : ST unit (requires fun _ -> exists (v:a{refine v}). x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ (exists (v:a{refine v}). entries x h1 `has` v)) = let u : squash (exists (v:a{refine v}). x `contains` v) = () in FStar.Classical.exists_elim (token_p x (fun h -> exists (v:a{refine v}). contains_h x v h)) u (fun v -> token_functoriality x (contains_h x v) (fun h -> exists (v:a{refine v}). contains_h x v h)); recall_p x (fun h -> exists (v:a{refine v}). contains_h x v h) let new_log #a : ST (t a) (requires fun _ -> True) (ensures fun h0 x h1 -> HS.contains h1 x /\ HS.sel h1 x == Seq.empty /\ B.fresh_loc (B.loc_mreference x) h0 h1 /\ HST.ralloc_post HS.root Seq.empty h0 x h1) = ralloc HS.root Seq.empty let add #a (x:t a) (v:a) : ST unit (requires fun _ -> True) (ensures fun h0 _ h1 -> x `contains` v /\ entries x h1 `has` v /\ HS.sel h1 x == Seq.snoc (HS.sel h0 x) v /\ B.modifies (B.loc_mreference x) h0 h1) = let l0 = !x in x := Seq.snoc l0 v; let h = get () in intro_contains_h (Seq.length l0) x v h; assert (contains_h x v h); contains_h_stable x v; witness_p x (x `contains_h` v) let not_found (#a:eqtype) (l:seq a) (f:a -> bool) = forall (x:a). x `Seq.mem` l ==> not (f x)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Seq.Base.seq a -> x: a -> FStar.Pervasives.Lemma (ensures FStar.Seq.Properties.mem x s <==> (exists (i: Prims.nat{i < FStar.Seq.Base.length s}). FStar.Seq.Base.index s i == x)) (decreases FStar.Seq.Base.length s)
FStar.Pervasives.Lemma
[ "lemma", "" ]
[]
[ "Prims.eqtype", "FStar.Seq.Base.seq", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.length", "Prims.bool", "FStar.Seq.Properties.head", "OPLSS.Log.index_mem", "FStar.Seq.Properties.tail", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.l_iff", "Prims.b2t", "FStar.Seq.Properties.mem", "Prims.l_Exists", "Prims.nat", "Prims.op_LessThan", "Prims.eq2", "FStar.Seq.Base.index", "Prims.Nil", "FStar.Pervasives.pattern" ]
[ "recursion" ]
false
false
true
false
false
let rec index_mem (#a: eqtype) (s: seq a) (x: a) : Lemma (ensures (Seq.mem x s <==> (exists i. Seq.index s i == x))) (decreases (Seq.length s)) =
if length s = 0 then () else if head s = x then () else index_mem (tail s) x
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.wfailwith
val wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv
val wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv
let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 41, "end_line": 604, "start_col": 0, "start_line": 598 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: Prims.string -> LowParseWriters.NoHoare.TWrite a
LowParseWriters.NoHoare.TWrite
[]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "Prims.string", "LowParseWriters.NoHoare.twrite_of_ewrite", "Prims.unit", "LowParseWriters.wfailwith" ]
[]
false
true
false
false
false
let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv =
twrite_of_ewrite (fun _ -> wfailwith s)
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.ewrite_of_twrite
val ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: (unit -> TWrite a p1 p2 l)) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l
val ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: (unit -> TWrite a p1 p2 l)) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l
let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ()))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 32, "end_line": 613, "start_col": 0, "start_line": 607 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
$f: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> LowParseWriters.EWrite a
LowParseWriters.EWrite
[]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "Prims.unit", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True" ]
[]
false
true
false
false
false
let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: (unit -> TWrite a p1 p2 l)) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l =
EWrite?.reflect (reify (f ()))
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.bind_impl'
val bind_impl': inv: memory_invariant -> p1: parser -> p2: parser -> p3: parser -> a: Type -> b: Type -> f: (unit -> TWrite a p1 p2 inv) -> g: (a -> unit -> TWrite b p2 p3 inv) -> Prims.unit -> TWrite b p1 p3 inv
val bind_impl': inv: memory_invariant -> p1: parser -> p2: parser -> p3: parser -> a: Type -> b: Type -> f: (unit -> TWrite a p1 p2 inv) -> g: (a -> unit -> TWrite b p2 p3 inv) -> Prims.unit -> TWrite b p1 p3 inv
let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x ()
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 24, "end_line": 586, "start_col": 0, "start_line": 578 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
inv: LowParseWriters.memory_invariant -> p1: LowParseWriters.LowParse.parser -> p2: LowParseWriters.LowParse.parser -> p3: LowParseWriters.LowParse.parser -> a: Type -> b: Type -> f: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> g: (_: a -> _: Prims.unit -> LowParseWriters.NoHoare.TWrite b) -> _: Prims.unit -> LowParseWriters.NoHoare.TWrite b
LowParseWriters.NoHoare.TWrite
[]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "Prims.unit" ]
[]
false
true
false
false
false
let bind_impl' (inv: memory_invariant) (p1: parser) (p2: parser) (p3: parser) (a: Type) (b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv =
let x = f () in g x ()
false
OPLSS.Log.fst
OPLSS.Log.find
val find (#a: _) (x: t a) (f: (a -> bool)) : ST (option a) (requires fun _ -> True) (ensures fun h0 o h1 -> h0 == h1 /\ (let l = HS.sel h1 x in match o with | None -> not_found l f | Some v -> contains x v /\ (entries x h1) `has` v /\ f v))
val find (#a: _) (x: t a) (f: (a -> bool)) : ST (option a) (requires fun _ -> True) (ensures fun h0 o h1 -> h0 == h1 /\ (let l = HS.sel h1 x in match o with | None -> not_found l f | Some v -> contains x v /\ (entries x h1) `has` v /\ f v))
let find #a (x:t a) (f: a -> bool) : ST (option a) (requires fun _ -> True) (ensures fun h0 o h1 -> h0 == h1 /\ (let l = HS.sel h1 x in match o with | None -> not_found l f | Some v -> contains x v /\ entries x h1 `has` v /\ f v)) = let l = !x in match Seq.find_l f l with | None -> Seq.find_l_none_no_index l f; FStar.Classical.forall_intro (index_mem l); None | Some v -> Seq.lemma_find_l_contains f l; Seq.contains_elim l v; contains_h_stable x v; witness_p x (x `contains_h` v); Some v
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 12, "end_line": 152, "start_col": 0, "start_line": 129 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in () let intro_contains_h #a (i:nat) (x:t a) (v:a) (h:HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) = Seq.contains_intro (HS.sel h x) i v let snoc_grows_contains #a (hd:a) (tl:seq a) : Lemma (tl `grows` snoc tl hd /\ index (snoc tl hd) (length tl) == hd) = () let contains #a (x:t a) (v:a) = token_p x (contains_h x v) let contains_now #a (x:t a) (v:a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1) = recall_p x (x `contains_h` v) assume val token_functoriality //demo scaffolding, should be in stdlib (#a:_) (#pre:_) (x:HST.mreference a pre) (p:mem_predicate{token_p x p}) (q:mem_predicate{(forall (h:mem). p h ==> q h)}) : Lemma (ensures token_p x q) let contains_now_e #a (x:t a) (refine: a -> Type) : ST unit (requires fun _ -> exists (v:a{refine v}). x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ (exists (v:a{refine v}). entries x h1 `has` v)) = let u : squash (exists (v:a{refine v}). x `contains` v) = () in FStar.Classical.exists_elim (token_p x (fun h -> exists (v:a{refine v}). contains_h x v h)) u (fun v -> token_functoriality x (contains_h x v) (fun h -> exists (v:a{refine v}). contains_h x v h)); recall_p x (fun h -> exists (v:a{refine v}). contains_h x v h) let new_log #a : ST (t a) (requires fun _ -> True) (ensures fun h0 x h1 -> HS.contains h1 x /\ HS.sel h1 x == Seq.empty /\ B.fresh_loc (B.loc_mreference x) h0 h1 /\ HST.ralloc_post HS.root Seq.empty h0 x h1) = ralloc HS.root Seq.empty let add #a (x:t a) (v:a) : ST unit (requires fun _ -> True) (ensures fun h0 _ h1 -> x `contains` v /\ entries x h1 `has` v /\ HS.sel h1 x == Seq.snoc (HS.sel h0 x) v /\ B.modifies (B.loc_mreference x) h0 h1) = let l0 = !x in x := Seq.snoc l0 v; let h = get () in intro_contains_h (Seq.length l0) x v h; assert (contains_h x v h); contains_h_stable x v; witness_p x (x `contains_h` v) let not_found (#a:eqtype) (l:seq a) (f:a -> bool) = forall (x:a). x `Seq.mem` l ==> not (f x) let rec index_mem (#a:eqtype) (s:seq a) (x:a) : Lemma (ensures (Seq.mem x s <==> (exists i. Seq.index s i == x))) (decreases (Seq.length s)) = if length s = 0 then () else if head s = x then () else index_mem (tail s) x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: OPLSS.Log.t a -> f: (_: a -> Prims.bool) -> FStar.HyperStack.ST.ST (FStar.Pervasives.Native.option a)
FStar.HyperStack.ST.ST
[]
[]
[ "Prims.eqtype", "OPLSS.Log.t", "Prims.bool", "FStar.Seq.Properties.find_l", "FStar.Pervasives.Native.None", "Prims.unit", "FStar.Classical.forall_intro", "Prims.l_iff", "Prims.b2t", "FStar.Seq.Properties.mem", "Prims.l_Exists", "Prims.nat", "Prims.op_LessThan", "FStar.Seq.Base.length", "Prims.eq2", "FStar.Seq.Base.index", "OPLSS.Log.index_mem", "FStar.Seq.Properties.find_l_none_no_index", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.Some", "FStar.HyperStack.ST.witness_p", "FStar.Seq.Base.seq", "OPLSS.Log.grows", "OPLSS.Log.contains_h", "OPLSS.Log.contains_h_stable", "FStar.Seq.Properties.contains_elim", "FStar.Seq.Properties.lemma_find_l_contains", "FStar.HyperStack.ST.op_Bang", "FStar.Monotonic.HyperStack.mem", "Prims.l_True", "Prims.l_and", "OPLSS.Log.not_found", "OPLSS.Log.contains", "OPLSS.Log.has", "OPLSS.Log.entries", "Prims.logical", "FStar.Monotonic.HyperStack.sel" ]
[]
false
true
false
false
false
let find #a (x: t a) (f: (a -> bool)) : ST (option a) (requires fun _ -> True) (ensures fun h0 o h1 -> h0 == h1 /\ (let l = HS.sel h1 x in match o with | None -> not_found l f | Some v -> contains x v /\ (entries x h1) `has` v /\ f v)) =
let l = !x in match Seq.find_l f l with | None -> Seq.find_l_none_no_index l f; FStar.Classical.forall_intro (index_mem l); None | Some v -> Seq.lemma_find_l_contains f l; Seq.contains_elim l v; contains_h_stable x v; witness_p x (x `contains_h` v); Some v
false
OPLSS.Log.fst
OPLSS.Log.add
val add (#a: _) (x: t a) (v: a) : ST unit (requires fun _ -> True) (ensures fun h0 _ h1 -> x `contains` v /\ (entries x h1) `has` v /\ HS.sel h1 x == Seq.snoc (HS.sel h0 x) v /\ B.modifies (B.loc_mreference x) h0 h1)
val add (#a: _) (x: t a) (v: a) : ST unit (requires fun _ -> True) (ensures fun h0 _ h1 -> x `contains` v /\ (entries x h1) `has` v /\ HS.sel h1 x == Seq.snoc (HS.sel h0 x) v /\ B.modifies (B.loc_mreference x) h0 h1)
let add #a (x:t a) (v:a) : ST unit (requires fun _ -> True) (ensures fun h0 _ h1 -> x `contains` v /\ entries x h1 `has` v /\ HS.sel h1 x == Seq.snoc (HS.sel h0 x) v /\ B.modifies (B.loc_mreference x) h0 h1) = let l0 = !x in x := Seq.snoc l0 v; let h = get () in intro_contains_h (Seq.length l0) x v h; assert (contains_h x v h); contains_h_stable x v; witness_p x (x `contains_h` v)
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 34, "end_line": 117, "start_col": 0, "start_line": 103 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in () let intro_contains_h #a (i:nat) (x:t a) (v:a) (h:HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) = Seq.contains_intro (HS.sel h x) i v let snoc_grows_contains #a (hd:a) (tl:seq a) : Lemma (tl `grows` snoc tl hd /\ index (snoc tl hd) (length tl) == hd) = () let contains #a (x:t a) (v:a) = token_p x (contains_h x v) let contains_now #a (x:t a) (v:a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1) = recall_p x (x `contains_h` v) assume val token_functoriality //demo scaffolding, should be in stdlib (#a:_) (#pre:_) (x:HST.mreference a pre) (p:mem_predicate{token_p x p}) (q:mem_predicate{(forall (h:mem). p h ==> q h)}) : Lemma (ensures token_p x q) let contains_now_e #a (x:t a) (refine: a -> Type) : ST unit (requires fun _ -> exists (v:a{refine v}). x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ (exists (v:a{refine v}). entries x h1 `has` v)) = let u : squash (exists (v:a{refine v}). x `contains` v) = () in FStar.Classical.exists_elim (token_p x (fun h -> exists (v:a{refine v}). contains_h x v h)) u (fun v -> token_functoriality x (contains_h x v) (fun h -> exists (v:a{refine v}). contains_h x v h)); recall_p x (fun h -> exists (v:a{refine v}). contains_h x v h) let new_log #a : ST (t a) (requires fun _ -> True) (ensures fun h0 x h1 -> HS.contains h1 x /\ HS.sel h1 x == Seq.empty /\ B.fresh_loc (B.loc_mreference x) h0 h1 /\ HST.ralloc_post HS.root Seq.empty h0 x h1) = ralloc HS.root Seq.empty
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: OPLSS.Log.t a -> v: a -> FStar.HyperStack.ST.ST Prims.unit
FStar.HyperStack.ST.ST
[]
[]
[ "Prims.eqtype", "OPLSS.Log.t", "FStar.HyperStack.ST.witness_p", "FStar.Seq.Base.seq", "OPLSS.Log.grows", "OPLSS.Log.contains_h", "Prims.unit", "OPLSS.Log.contains_h_stable", "Prims._assert", "OPLSS.Log.intro_contains_h", "FStar.Seq.Base.length", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "FStar.HyperStack.ST.op_Colon_Equals", "FStar.Seq.Properties.snoc", "FStar.HyperStack.ST.op_Bang", "Prims.l_True", "Prims.l_and", "OPLSS.Log.contains", "Prims.b2t", "OPLSS.Log.has", "OPLSS.Log.entries", "Prims.eq2", "FStar.Monotonic.HyperStack.sel", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_mreference" ]
[]
false
true
false
false
false
let add #a (x: t a) (v: a) : ST unit (requires fun _ -> True) (ensures fun h0 _ h1 -> x `contains` v /\ (entries x h1) `has` v /\ HS.sel h1 x == Seq.snoc (HS.sel h0 x) v /\ B.modifies (B.loc_mreference x) h0 h1) =
let l0 = !x in x := Seq.snoc l0 v; let h = get () in intro_contains_h (Seq.length l0) x v h; assert (contains_h x v h); contains_h_stable x v; witness_p x (x `contains_h` v)
false
OPLSS.Log.fst
OPLSS.Log.new_log
val new_log (#a: _) : ST (t a) (requires fun _ -> True) (ensures fun h0 x h1 -> HS.contains h1 x /\ HS.sel h1 x == Seq.empty /\ B.fresh_loc (B.loc_mreference x) h0 h1 /\ HST.ralloc_post HS.root Seq.empty h0 x h1)
val new_log (#a: _) : ST (t a) (requires fun _ -> True) (ensures fun h0 x h1 -> HS.contains h1 x /\ HS.sel h1 x == Seq.empty /\ B.fresh_loc (B.loc_mreference x) h0 h1 /\ HST.ralloc_post HS.root Seq.empty h0 x h1)
let new_log #a : ST (t a) (requires fun _ -> True) (ensures fun h0 x h1 -> HS.contains h1 x /\ HS.sel h1 x == Seq.empty /\ B.fresh_loc (B.loc_mreference x) h0 h1 /\ HST.ralloc_post HS.root Seq.empty h0 x h1) = ralloc HS.root Seq.empty
{ "file_name": "examples/crypto/OPLSS.Log.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 101, "start_col": 0, "start_line": 93 }
module OPLSS.Log open FStar.HyperStack.ST open FStar.Seq open FStar.Monotonic.Seq open FStar.HyperStack module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module B = LowStar.Monotonic.Buffer module L = FStar.List.Tot let grows (#a:Type) : Preorder.preorder (seq a) = fun (s1:seq a) (s2:seq a) -> length s1 <= length s2 /\ (forall (i:nat).{:pattern (index s1 i) \/ (index s2 i)} i < length s1 ==> index s1 i == index s2 i) let t (a:eqtype) = HST.mref (seq a) grows let fp #a (x:t a) = B.loc_mreference x let entries #a (x:t a) (h:HS.mem) = HS.sel h x let has (#a:eqtype) (l:seq a) (x:a) = Seq.mem x l private let contains_h #a (x:t a) (v:a) (h:HS.mem) : Type = entries x h `has` v let contains_h_stable #a (x:t a) (v:a) : Lemma ((x `contains_h` v) `stable_on` x) = let aux (h0 h1:HS.mem) : Lemma (contains_h x v h0 /\ grows (HS.sel h0 x) (HS.sel h1 x) ==> contains_h x v h1) [SMTPat (contains_h x v h0); SMTPat (contains_h x v h1)] = let aux (s:seq a) (x:a) (k:nat) : Lemma (k < Seq.length s /\ Seq.index s k == x ==> x `Seq.mem` s) [SMTPat (Seq.index s k); SMTPat (x `Seq.mem` s)] = () in FStar.Classical.move_requires (mem_index v) (HS.sel h0 x) in () let intro_contains_h #a (i:nat) (x:t a) (v:a) (h:HS.mem) : Lemma (requires i < Seq.length (HS.sel h x) /\ index (HS.sel h x) i == v) (ensures contains_h x v h) = Seq.contains_intro (HS.sel h x) i v let snoc_grows_contains #a (hd:a) (tl:seq a) : Lemma (tl `grows` snoc tl hd /\ index (snoc tl hd) (length tl) == hd) = () let contains #a (x:t a) (v:a) = token_p x (contains_h x v) let contains_now #a (x:t a) (v:a) : ST unit (requires fun _ -> x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ contains_h x v h1) = recall_p x (x `contains_h` v) assume val token_functoriality //demo scaffolding, should be in stdlib (#a:_) (#pre:_) (x:HST.mreference a pre) (p:mem_predicate{token_p x p}) (q:mem_predicate{(forall (h:mem). p h ==> q h)}) : Lemma (ensures token_p x q) let contains_now_e #a (x:t a) (refine: a -> Type) : ST unit (requires fun _ -> exists (v:a{refine v}). x `contains` v) (ensures fun h0 _ h1 -> h0 == h1 /\ (exists (v:a{refine v}). entries x h1 `has` v)) = let u : squash (exists (v:a{refine v}). x `contains` v) = () in FStar.Classical.exists_elim (token_p x (fun h -> exists (v:a{refine v}). contains_h x v h)) u (fun v -> token_functoriality x (contains_h x v) (fun h -> exists (v:a{refine v}). contains_h x v h)); recall_p x (fun h -> exists (v:a{refine v}). contains_h x v h)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Monotonic.Buffer.fsti.checked", "FStar.Seq.fst.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Seq.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Log.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Monotonic.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.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.HyperStack.ST.ST (OPLSS.Log.t a)
FStar.HyperStack.ST.ST
[]
[]
[ "Prims.eqtype", "FStar.HyperStack.ST.ralloc", "FStar.Seq.Base.seq", "OPLSS.Log.grows", "FStar.Monotonic.HyperHeap.root", "FStar.Seq.Base.empty", "FStar.HyperStack.ST.mref", "OPLSS.Log.t", "FStar.Monotonic.HyperStack.mem", "Prims.l_True", "Prims.l_and", "FStar.Monotonic.HyperStack.contains", "Prims.eq2", "FStar.Monotonic.HyperStack.sel", "LowStar.Monotonic.Buffer.fresh_loc", "LowStar.Monotonic.Buffer.loc_mreference", "FStar.HyperStack.ST.ralloc_post" ]
[]
false
true
false
false
false
let new_log #a : ST (t a) (requires fun _ -> True) (ensures fun h0 x h1 -> HS.contains h1 x /\ HS.sel h1 x == Seq.empty /\ B.fresh_loc (B.loc_mreference x) h0 h1 /\ HST.ralloc_post HS.root Seq.empty h0 x h1) =
ralloc HS.root Seq.empty
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.frame
val frame (#a: Type) (#fr #p: parser) (#l: memory_invariant) ($f: (unit -> TWrite a parse_empty p l)) : TWrite a fr (fr `parse_pair` p) l
val frame (#a: Type) (#fr #p: parser) (#l: memory_invariant) ($f: (unit -> TWrite a parse_empty p l)) : TWrite a fr (fr `parse_pair` p) l
let frame (#a: Type) (#fr: parser) (#p: parser) (#l: memory_invariant) ($f: unit -> TWrite a parse_empty p l ) : TWrite a fr (fr `parse_pair` p) l = twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 74, "end_line": 627, "start_col": 0, "start_line": 616 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s) inline_for_extraction let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ()))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
$f: (_: Prims.unit -> LowParseWriters.NoHoare.TWrite a) -> LowParseWriters.NoHoare.TWrite a
LowParseWriters.NoHoare.TWrite
[]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.unit", "LowParseWriters.LowParse.parse_empty", "LowParseWriters.NoHoare.twrite_of_ewrite", "LowParseWriters.LowParse.parse_pair", "LowParseWriters.frame'", "LowParseWriters.NoHoare.ewrite_of_twrite" ]
[]
false
true
false
false
false
let frame (#a: Type) (#fr #p: parser) (#l: memory_invariant) ($f: (unit -> TWrite a parse_empty p l)) : TWrite a fr (fr `parse_pair` p) l =
twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f))
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.cat
val cat (#inv: memory_invariant) (#p: parser) (x: ptr p inv) : TWrite unit parse_empty p inv
val cat (#inv: memory_invariant) (#p: parser) (x: ptr p inv) : TWrite unit parse_empty p inv
let cat (#inv: memory_invariant) (#p: parser) (x: ptr p inv) : TWrite unit parse_empty p inv = twrite_of_ewrite (fun _ -> cat x)
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 35, "end_line": 688, "start_col": 0, "start_line": 683 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s) inline_for_extraction let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ())) inline_for_extraction let frame (#a: Type) (#fr: parser) (#p: parser) (#l: memory_invariant) ($f: unit -> TWrite a parse_empty p l ) : TWrite a fr (fr `parse_pair` p) l = twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f)) let valid_rewrite_compose (#p1: parser) (#p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3)) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_compose _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v12) _ _ _ (evalid_rewrite_of_tvalid_rewrite v23)) inline_for_extraction let valid_rewrite (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv = twrite_of_ewrite (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let cast (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) (x1: ptr p1 inv) : Tot (ptr p2 inv) = cast _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v) _ x1 let valid_rewrite_parse_pair_assoc_1 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop ((p1 `parse_pair` p2) `parse_pair` p3) (p1 `parse_pair` (p2 `parse_pair` p3)))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_1 p1 p2 p3) let valid_rewrite_parse_pair_assoc_2 (p1 p2 p3: parser) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` (p2 `parse_pair` p3)) ((p1 `parse_pair` p2) `parse_pair` p3))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_assoc_2 p1 p2 p3) let valid_rewrite_parse_pair_compat_l (p: parser) (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p `parse_pair` p1) (p `parse_pair` p2))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_compat_l p _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v)) let valid_rewrite_parse_pair_compat_r (p: parser) (#p1 #p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (squash (valid_rewrite_prop (p1 `parse_pair` p) (p2 `parse_pair` p))) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_parse_pair_compat_r p _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: LowParseWriters.ptr p inv -> LowParseWriters.NoHoare.TWrite Prims.unit
LowParseWriters.NoHoare.TWrite
[]
[]
[ "LowParseWriters.memory_invariant", "LowParseWriters.LowParse.parser", "LowParseWriters.ptr", "LowParseWriters.NoHoare.twrite_of_ewrite", "Prims.unit", "LowParseWriters.LowParse.parse_empty", "LowParseWriters.cat" ]
[]
false
true
false
false
false
let cat (#inv: memory_invariant) (#p: parser) (x: ptr p inv) : TWrite unit parse_empty p inv =
twrite_of_ewrite (fun _ -> cat x)
false
Vale.AES.X64.AESGCM_expected_code.fst
Vale.AES.X64.AESGCM_expected_code.va_codegen_success_Loop6x_partial_expected_code
val va_codegen_success_Loop6x_partial_expected_code : alg:algorithm -> Tot va_pbool
val va_codegen_success_Loop6x_partial_expected_code : alg:algorithm -> Tot va_pbool
let va_codegen_success_Loop6x_partial_expected_code alg = (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_pbool_and (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrqImm (va_op_xmm_xmm 5) 1 0 (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrqImm (va_op_xmm_xmm 5) 2 0 (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15))))))))))))))))))))))))))) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false true) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRcx) (16 - 128) Secret) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 48 Secret) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (16 - 32) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) false false) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_opr128_xmm 4)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 1) (va_op_opr128_xmm 5)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) false true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (1 + 1) - 128) Secret) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) true false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 16 Secret)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) true true) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 64 Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (5 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (5 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (2 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (2 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64 rR9) (48 - 32) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (2 + 1) - 128) Secret) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 1)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) false false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 2)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) false true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) true false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) true true) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 80 Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 1)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR9) (64 - 32) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (3 + 1) - 128) Secret) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 2)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) false false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) false true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (4 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 5)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) true false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (4 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) true true) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 96 Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (3 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (3 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 2)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rR9) (96 - 32) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (4 + 1) - 128) Secret) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) false false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) false true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (3 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 1)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) true false) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 112 Secret)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (3 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) true true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (4 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (4 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 3)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (112 - 32) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (5 + 1) - 128) Secret) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) false true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 1)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) true false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (2 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 2)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) false false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (2 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) true true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (5 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (5 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 1)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (6 + 1) - 128) Secret) (va_pbool_and (va_codegen_success_VLow64ToHigh (va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 2)) (va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_PinsrqImm (va_op_xmm_xmm 3) 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 8)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 5)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (1 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (1 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VSwap (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) false true) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (6 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (6 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (128 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (144 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VHigh64ToLow (va_op_xmm_xmm 6) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 6)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 0)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_pbool_and (if (alg = AES_256) then va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (176 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (208 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret) (va_ttrue ())))))))))))))))))))))))))))) else va_ttrue ()) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret) (va_pbool_and (va_codegen_success_VSwap (va_op_xmm_xmm 8) (va_op_xmm_xmm 4)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) false true) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_ttrue ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
{ "file_name": "obj/Vale.AES.X64.AESGCM_expected_code.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 183, "end_line": 609, "start_col": 0, "start_line": 304 }
module Vale.AES.X64.AESGCM_expected_code open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Types_s open FStar.Seq open Vale.AES.AES_s open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.InsAes open Vale.X64.QuickCode open Vale.X64.QuickCodes open Vale.Arch.Types open Vale.AES.AES_helpers //open Vale.Poly1305.Math // For lemma_poly_bits64() open Vale.AES.GCM_helpers open Vale.AES.GCTR_s open Vale.AES.GCTR open Vale.Arch.TypesNative open Vale.X64.CPU_Features_s open Vale.AES.X64.PolyOps open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.AES.GHash open Vale.AES.X64.AESopt2 #reset-options "--z3rlimit 50" //-- Loop6x_partial_expected_code [@ "opaque_to_smt"] let va_code_Loop6x_partial_expected_code alg = (va_Block (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_CCons (va_IfElse (va_cmp_ge (va_op_cmp_reg64 rRbx) (va_const_cmp 256)) (va_Block (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 5)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 5) 1 0 (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 5)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 5) 2 0 (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_CNil ())))))))))))))))))))))))) (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CNil ()))))))) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRcx) (16 - 128) Secret) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 48 Secret) (va_CCons (va_code_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (16 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 2)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) false false) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_opr128_xmm 4)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 2)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 1) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (1 + 1) - 128) Secret) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 16 Secret)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) true true) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 64 Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (5 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (5 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (2 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (2 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64 rR9) (48 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (2 + 1) - 128) Secret) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 1)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 2)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 3)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) true true) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 80 Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR9) (64 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (3 + 1) - 128) Secret) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 2)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 3)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (4 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (4 `op_Multiply` 16) Secret false) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) true true) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 96 Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (3 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (3 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rR9) (96 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (4 + 1) - 128) Secret) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 3)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (3 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 1)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) true false) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 112 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (3 `op_Multiply` 16) Secret false) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) true true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (4 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (4 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 3)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (112 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (5 + 1) - 128) Secret) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 1)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (2 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 2)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (2 `op_Multiply` 16) Secret false) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) true true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (5 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (5 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (6 + 1) - 128) Secret) (va_CCons (va_code_VLow64ToHigh (va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 2)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 3)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 3) 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 8)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 5)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (1 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (1 `op_Multiply` 16) Secret false) (va_CCons (va_code_VSwap (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (6 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (6 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (128 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (144 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VHigh64ToLow (va_op_xmm_xmm 6) (va_op_xmm_xmm 6)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 6)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 0)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_CCons (if (alg = AES_256) then va_Block (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (176 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (208 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret) (va_CNil ()))))))))))))))))))))))))))))) else va_Block (va_CNil ())) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret) (va_CCons (va_code_VSwap (va_op_xmm_xmm 8) (va_op_xmm_xmm 4)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_CNil ()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.InsAes.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.X64.PolyOps.fsti.checked", "Vale.AES.X64.AESopt2.fsti.checked", "Vale.AES.GHash.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "Vale.AES.GCTR_s.fst.checked", "Vale.AES.GCTR.fsti.checked", "Vale.AES.GCM_helpers.fsti.checked", "Vale.AES.AES_s.fst.checked", "Vale.AES.AES_helpers.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.X64.AESGCM_expected_code.fst" }
[ { "abbrev": false, "full_module": "Vale.AES.X64.AESopt2", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash", "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.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsAes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
alg: Vale.AES.AES_common_s.algorithm -> Vale.X64.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Vale.AES.AES_common_s.algorithm", "Vale.X64.Decls.va_pbool_and", "Vale.X64.InsBasic.va_codegen_success_Add64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRbx", "Vale.X64.Decls.va_const_opr64", "Vale.X64.InsVector.va_codegen_success_InitPshufbMask", "Vale.X64.Decls.va_op_xmm_xmm", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.X64.Machine_s.rR11", "Vale.X64.InsVector.va_codegen_success_VPshufb", "Vale.X64.InsVector.va_codegen_success_ZeroXmm", "Vale.X64.InsVector.va_codegen_success_PinsrqImm", "Vale.X64.InsVector.va_codegen_success_VPaddd", "Vale.X64.InsVector.va_codegen_success_Load128_buffer", "Vale.X64.Decls.va_op_heaplet_mem_heaplet", "Vale.X64.Machine_s.rR9", "Prims.op_Subtraction", "Vale.Arch.HeapTypes_s.Secret", "Vale.X64.InsVector.va_codegen_success_VPxor", "Vale.X64.Decls.va_op_opr128_xmm", "Vale.X64.InsBasic.va_codegen_success_Sub64", "Vale.X64.InsVector.va_codegen_success_Store128_buffer", "Vale.X64.Machine_s.rRbp", "Vale.AES.X64.PolyOps.va_codegen_success_VPolyMul", "Vale.X64.Machine_s.rRcx", "Vale.X64.InsAes.va_codegen_success_VAESNI_enc", "Vale.AES.X64.PolyOps.va_codegen_success_VPolyAdd", "Prims.op_Multiply", "Prims.op_Addition", "Vale.X64.InsVector.va_codegen_success_Mem128_lemma", "Vale.X64.Decls.va_opr_code_Mem128", "Vale.X64.Decls.va_op_reg64_reg64", "Vale.X64.InsVector.va_codegen_success_LoadBe64_buffer128", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR12", "Vale.X64.InsVector.va_codegen_success_Store64_buffer128", "Vale.AES.X64.PolyOps.va_codegen_success_VLow64ToHigh", "Vale.AES.X64.PolyOps.va_codegen_success_VSwap", "Vale.AES.X64.PolyOps.va_codegen_success_VHigh64ToLow", "Prims.op_Equality", "Vale.AES.AES_common_s.AES_256", "Vale.X64.Decls.va_ttrue", "Prims.bool", "Vale.X64.Decls.va_pbool", "Vale.X64.Machine_s.rRdi" ]
[]
false
false
false
true
false
let va_codegen_success_Loop6x_partial_expected_code alg =
(va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_pbool_and (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrqImm (va_op_xmm_xmm 5) 1 0 (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrqImm (va_op_xmm_xmm 5) 2 0 (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 12 ) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor ( va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15 )) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1 ) (va_op_xmm_xmm 13 ) (va_op_xmm_xmm 5 )) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 1 ) (va_op_xmm_xmm 1 ) (va_op_xmm_xmm 0 )) (va_pbool_and (va_codegen_success_Sub64 ( va_op_dst_opr64_reg64 rRbx ) ( va_const_opr64 256 ) ) (va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 3 ) ( va_op_reg_opr64_reg64 rR9 ) ( 0 - 32 ) Secret ) ( va_pbool_and ( va_codegen_success_VPaddd ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 14 ) ) ( va_pbool_and ( va_codegen_success_VPxor ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_opr128_xmm 15 ) ) ( va_codegen_success_VPxor ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_opr128_xmm 15 ) ) ) ) )) )))))))))))) ))))))))) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false true) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRcx) (16 - 128) Secret) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 48 Secret) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false false) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true true) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (16 - 32) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) false false) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 8 ) (va_op_xmm_xmm 8 ) (va_op_opr128_xmm 4)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 1) (va_op_opr128_xmm 5)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_xmm_xmm 1 ) (va_op_xmm_xmm 0 ) (va_op_xmm_xmm 3 ) false true ) (va_pbool_and (va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 2 ) ) (va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 1 + 1 ) - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 3 ) true false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Mem128_lemma () ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 8 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg64_reg64 rRbp ) 16 Secret ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 3 ) true true ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 3 ) ( va_op_xmm_xmm 0 ) ( va_op_reg_opr64_reg64 rRbp ) 64 Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 5 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 5 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 2 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 2 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 5 ) ( va_op_reg_opr64_reg64 rR9 ) ( 48 - 32 ) Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 2 + 1 ) - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 5 ) false false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 2 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 5 ) false true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 3 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 5 ) true false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 5 ) true true ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 3 ) ( va_op_xmm_xmm 0 ) ( va_op_reg_opr64_reg64 rRbp ) 80 Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rR9 ) ( 64 - 32 ) Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 3 + 1 ) - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 2 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) false false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 3 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) false true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 4 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 5 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) true false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 4 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) true true ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 3 ) ( va_op_xmm_xmm 0 ) ( va_op_reg_opr64_reg64 rRbp ) 96 Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 3 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 3 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 2 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 2 ) ( va_op_reg_opr64_reg64 rR9 ) ( 96 - 32 ) Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 4 + 1 ) - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 3 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 2 ) false false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 5 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 2 ) false true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 3 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 2 ) true false ) ( va_pbool_and ( va_codegen_success_Mem128_lemma () ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 8 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg64_reg64 rRbp ) 112 Secret ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 3 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 2 ) true true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 4 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 4 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 3 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 3 ) ( va_op_reg_opr64_reg64 rR9 ) ( 112 - 32 ) Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 5 + 1 ) - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 5 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 3 ) false true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 3 ) true false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 2 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 2 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 3 ) false false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 2 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 3 ) true true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 5 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 5 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 5 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 6 + 1 ) - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VLow64ToHigh ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 6 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 2 ) ) ( va_pbool_and ( va_codegen_success_ZeroXmm ( va_op_xmm_xmm 3 ) ) ( va_pbool_and ( va_codegen_success_PinsrqImm ( va_op_xmm_xmm 3 ) 13979173243358019584 1 ( va_op_reg_opr64_reg64 rR11 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 8 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 5 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 1 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 1 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VSwap ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 4 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 3 ) false true ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 6 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 6 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 128 - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 144 - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VHigh64ToLow ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 6 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 0 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 0 `op_Multiply` 16 + 8 ) Secret true ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 0 `op_Multiply` 16 ) Secret false ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 160 - 128 ) Secret ) ( va_pbool_and ( if ( alg = AES_256 ) then va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 176 - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 192 - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 208 - 128 ) Secret ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 1 ) ) ( va_pbool_and ( va_codegen_success_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 224 - 128 ) Secret ) ( va_ttrue () ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) else va_ttrue () ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Store128_buffer ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_xmm_xmm 7 ) 16 Secret ) ( va_pbool_and ( va_codegen_success_VSwap ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 4 ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_VPolyMul ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 3 ) false true ) ( va_pbool_and ( va_codegen_success_Mem128_lemma () ) ( va_pbool_and ( va_codegen_success_VPxor ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 0 Secret ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Mem128_lemma () ) ( va_pbool_and ( va_codegen_success_VPxor ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 16 Secret ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Mem128_lemma () ) ( va_pbool_and ( va_codegen_success_VPxor ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 32 Secret ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Mem128_lemma () ) ( va_pbool_and ( va_codegen_success_VPxor ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 48 Secret ) ) ( va_pbool_and ( va_codegen_success_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_pbool_and ( va_codegen_success_Mem128_lemma () ) ( va_pbool_and ( va_codegen_success_VPxor ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 64 Secret ) ) ( va_pbool_and ( va_codegen_success_Mem128_lemma () ) ( va_pbool_and ( va_codegen_success_VPxor ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 80 Secret ) ) ( va_ttrue () ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )) )))))))))))) )))))))))))
false
LowParseWriters.NoHoare.fst
LowParseWriters.NoHoare.valid_rewrite
val valid_rewrite (#p1 #p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv
val valid_rewrite (#p1 #p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv
let valid_rewrite (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv = twrite_of_ewrite (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v))
{ "file_name": "examples/layeredeffects/LowParseWriters.NoHoare.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 92, "end_line": 645, "start_col": 0, "start_line": 639 }
module LowParseWriters.NoHoare include LowParseWriters inline_for_extraction let read_repr (t: Type) (inv: memory_invariant) : Tot Type = read_repr t True (fun _ -> True) (fun _ -> True) inv inline_for_extraction let read_reify_trivial (#a: Type) (#l: memory_invariant) (f: (unit -> ERead a True (fun _ -> True) (fun _ -> True) l)) : Tot (read_repr a l) = reify (f ()) inline_for_extraction let read_return_conv (t: Type) (x: t) (inv: memory_invariant) () : ERead t True (fun _ -> True) (fun _ -> True) inv = x inline_for_extraction let read_return (t: Type) (x: t) (inv: memory_invariant) : Tot (read_repr t inv) = read_reify_trivial (read_return_conv t x inv) inline_for_extraction let read_bind_conv (a:Type) (b:Type) (l_f: memory_invariant) (l_g: memory_invariant) (_:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) () : ERead b True (fun _ -> True) (fun _ -> True) l_g = let x = ERead?.reflect f_bind in ERead?.reflect (g x) inline_for_extraction let read_bind (a:Type) (b:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] p:squash (l_f == l_g)) (f_bind : read_repr a l_f) (g : (x: a -> read_repr b l_g)) : Tot (read_repr b l_g) = read_reify_trivial (read_bind_conv a b l_f l_g () f_bind g) inline_for_extraction let read_subcomp_conv (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) (sq: squash (l `memory_invariant_includes` l')) () : ERead a True (fun _ -> True) (fun _ -> True) l' = let x = ERead?.reflect f_subcomp in x inline_for_extraction let read_subcomp (a:Type) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:read_repr a l) : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True)) = read_reify_trivial (read_subcomp_conv a l l' f_subcomp ()) inline_for_extraction let read_if_then_else (a:Type) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr:squash (l_f == l_g)) (f_ifthenelse:read_repr a l_f) (g:read_repr a l_g) (p:bool) : Tot Type = read_repr a l_g reifiable reflectable total effect { TRead (a:Type) (_:memory_invariant) with {repr = read_repr; return = read_return; bind = read_bind; subcomp = read_subcomp; if_then_else = read_if_then_else} } inline_for_extraction let lift_pure_read_conv (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) (sq: squash (wp (fun _ -> True))) () : ERead a True (fun _ -> True) (fun _ -> True) l = f_pure () inline_for_extraction let lift_pure_read' (a:Type) (wp:pure_wp a) (l: memory_invariant) (f_pure:unit -> PURE a wp) : Pure (read_repr a l) (requires (wp (fun _ -> True))) (ensures (fun _ -> True)) = read_reify_trivial (lift_pure_read_conv a wp l f_pure ()) sub_effect PURE ~> TRead = lift_pure_read' (* let read_bind_spec' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : GTot (result b) = match ReadRepr?.spec (reify (f ())) () with | Error e -> Error e | Correct x -> ReadRepr?.spec (reify (g x)) () let read_bind_impl' (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : TRead b inv = let x = f () in g x let read_bind_correct (inv: memory_invariant) (a b: Type) (f: (unit -> TRead a inv)) (g: (a -> TRead b inv)) : Lemma (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) = assert_norm (ReadRepr?.spec (reify (read_bind_impl' inv a b f g)) () == read_bind_spec' inv a b f g) *) inline_for_extraction let tread_of_eread // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (f: unit -> ERead a True (fun _ -> True) (fun _ -> True) l) : TRead a l = TRead?.reflect (read_reify_trivial f) inline_for_extraction let eread_of_tread (#a: Type) (#l: memory_invariant) (f: unit -> TRead a l) : ERead a True (fun _ -> True) (fun _ -> True) l = ERead?.reflect (reify (f ())) inline_for_extraction let failwith (#a: Type) (#inv: memory_invariant) (s: string) : TRead a inv = tread_of_eread (fun _ -> failwith s) module B = LowStar.Buffer module U32 = FStar.UInt32 inline_for_extraction let buffer_index (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i < B.length b }) : TRead t inv = tread_of_eread (fun _ -> buffer_index b i) inline_for_extraction let buffer_sub (#t: Type) (#inv: memory_invariant) (b: B.buffer t) (i: U32.t) (len: Ghost.erased U32.t { B.live inv.h0 b /\ B.loc_buffer b `B.loc_disjoint` inv.lwrite /\ U32.v i + U32.v len <= B.length b }) : TRead (B.buffer t) inv = tread_of_eread (fun _ -> buffer_sub b i len) inline_for_extraction let repr (a: Type u#x) (r_in: parser) (r_out: parser) (l: memory_invariant) : Tot Type = repr a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l inline_for_extraction let reify_trivial (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l)) : Tot (repr a p1 p2 l) = reify (f ()) inline_for_extraction let return_conv (t: Type) (x: t) (r: parser) (inv: memory_invariant) () : EWrite t r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = x inline_for_extraction let returnc (t: Type) (x: t) (r: parser) (inv: memory_invariant) : Tot (repr t r r inv) = reify_trivial (return_conv t x r inv) inline_for_extraction let bind_conv (a:Type) (b:Type) (r_in_f:parser) (r_out_f: parser) (l_f:memory_invariant) (r_in_g:parser) (r_out_g: parser) (l_g: memory_invariant) (_:squash (r_out_f == r_in_g)) (_:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b r_in_g r_out_g l_g)) () : EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g = let x = EWrite?.reflect f_bind in EWrite?.reflect (g x) inline_for_extraction let bind (a:Type) (b:Type) (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (l_f == l_g)) (f_bind : repr a r_in_f r_out_f l_f) (g : (x: a -> repr b (r_in_g) r_out_g l_g)) : Tot (repr b r_in_f r_out_g l_g) = reify_trivial (bind_conv a b r_in_f r_out_f l_f r_in_g r_out_g l_g () () f_bind g) noeq type valid_rewrite_t' (p1: parser) (p2: parser) = | ValidSynth: (f: (Parser?.t p1 -> GTot (Parser?.t p2))) -> (v: LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) f) -> valid_rewrite_t' p1 p2 let valid_rewrite_prop (p1 p2: parser) : GTot Type0 = exists (x: valid_rewrite_t' p1 p2) . True (* // unfold let valid_rewrite_t (p1 p2: parser) : Tot Type0 = squash (valid_rewrite_prop p1 p2) *) let tvalid_rewrite_of_evalid_rewrite (#p1: parser) (#p2: parser) (#precond: pre_t p1) (#f: (x: Parser?.t p1 { precond x }) -> GTot (Parser?.t p2)) (v: LowParseWriters.valid_rewrite_t p1 p2 precond f { forall (x: Parser?.t p1) . precond x }) : Tot (squash (valid_rewrite_prop p1 p2)) = let _ = ValidSynth f (valid_rewrite_implies _ _ _ _ v _ _) in () let evalid_rewrite_of_tvalid_rewrite_f (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) (x: Parser?.t p1) : GTot (Parser?.t p2) = let v' : valid_rewrite_t' p1 p2 = FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True) in ValidSynth?.f v' x let evalid_rewrite_of_tvalid_rewrite (#p1: parser) (#p2: parser) (v: squash (valid_rewrite_prop p1 p2)) : Tot (LowParseWriters.valid_rewrite_t p1 p2 (fun _ -> True) (evalid_rewrite_of_tvalid_rewrite_f v)) = valid_rewrite_implies _ _ _ _ (ValidSynth?.v (FStar.IndefiniteDescription.indefinite_description_ghost (valid_rewrite_t' p1 p2) (fun _ -> True))) _ _ let valid_rewrite_refl (p: parser) : Lemma (valid_rewrite_prop p p) [SMTPat (valid_rewrite_prop p p)] = let x = tvalid_rewrite_of_evalid_rewrite #p #p #(fun _ -> True) #(fun x -> x) ({ valid_rewrite_valid = (fun h b pos pos' -> ()); valid_rewrite_size = (fun x -> ()); }) in () inline_for_extraction let valid_rewrite_repr (#p1: parser) (#p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : Tot (repr unit p1 p2 inv) = reify_trivial (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v)) inline_for_extraction let subcomp_conv (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) (sq: squash ( l `memory_invariant_includes` l' )) () : EWrite a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l' = let x = EWrite?.reflect f_subcomp in x inline_for_extraction let subcomp1 (a:Type) (r_in:parser) (r_out: parser) (l:memory_invariant) (l' : memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out l') (requires ( l `memory_invariant_includes` l' )) (ensures (fun _ -> True)) = reify_trivial (subcomp_conv a r_in r_out l l' f_subcomp ()) inline_for_extraction let subcomp2 (a:Type) (r_in:parser) (r_out r_out': parser) (l:memory_invariant) (f_subcomp:repr a r_in r_out l) : Pure (repr a r_in r_out' l) (requires ( valid_rewrite_prop r_out r_out' )) (ensures (fun _ -> True)) = bind a a r_in r_out l r_out r_out' l () () f_subcomp (fun x -> bind unit a r_out r_out' l r_out' r_out' l () () (valid_rewrite_repr ()) (fun _ -> returnc a x r_out' l)) inline_for_extraction let subcomp (a:Type) ([@@@ refl_implicit] r_in_f:parser) (r_out_f:parser) (l_f:memory_invariant) ([@@@ refl_implicit] r_in_g:parser) (r_out_g: parser) (l_g:memory_invariant) ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g)) (f_subcomp:repr a r_in_f r_out_f l_f) : Pure (repr a r_in_g r_out_g l_g) (requires ( l_f `memory_invariant_includes` l_g /\ valid_rewrite_prop r_out_f r_out_g )) (ensures (fun _ -> True)) = subcomp2 a r_in_f r_out_f r_out_g l_g (subcomp1 a r_in_f r_out_f l_f l_g f_subcomp) let if_then_else (a:Type) ([@@@ refl_implicit] r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser) ([@@@ refl_implicit] l_f: memory_invariant) ([@@@ refl_implicit] r_in_g:parser) ([@@@ refl_implicit] r_out_g: parser) ([@@@ refl_implicit] l_g: memory_invariant) ([@@@ refl_implicit] pr1:squash (r_in_f == r_in_g)) ([@@@ refl_implicit] pr2:squash (r_out_f == r_out_g)) ([@@@ refl_implicit] pr3:squash (l_f == l_g)) (f_ifthenelse:repr a r_in_f r_out_f l_f) (g:repr a r_in_g r_out_g l_g) (p:bool) : Tot Type = repr a r_in_g r_out_g l_g reifiable reflectable total effect { TWrite (a:Type) (pin: parser) (pout:parser) (_:memory_invariant) with {repr; return = returnc; bind; subcomp; if_then_else} } inline_for_extraction let lift_read_conv (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) () : EWrite a r r (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) inv = let x = ERead?.reflect f_read_spec in x inline_for_extraction let lift_read (a: Type) (inv: memory_invariant) (r: parser) (f_read_spec: read_repr a inv) : Tot (repr a r r inv) = reify_trivial (lift_read_conv a inv r f_read_spec) sub_effect TRead ~> TWrite = lift_read let destr_repr_spec (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_spec a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True)) = Repr?.spec (reify (f_destr_spec ())) inline_for_extraction let destr_repr_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (#l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec)) = Repr?.impl (reify (f_destr_spec ())) module HST = FStar.HyperStack.ST module HS = FStar.HyperStack inline_for_extraction let extract_t (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot Type = (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) -> (len: U32.t { len == B.len b }) -> (pos1: buffer_offset b) -> HST.Stack (iresult a) (requires (fun h -> B.modifies l.lwrite l.h0 h /\ HS.get_tip l.h0 `HS.includes` HS.get_tip h /\ valid_pos r_in h b 0ul pos1 )) (ensures (fun h res h' -> valid_pos r_in h b 0ul pos1 /\ B.modifies (B.loc_buffer b) h h' /\ ( let v_in = contents r_in h b 0ul pos1 in begin match destr_repr_spec f_destr_spec v_in, res with | Correct (v, v_out), ICorrect v' pos2 -> U32.v pos1 <= U32.v pos2 /\ valid_pos (r_out) h' b 0ul pos2 /\ v' == v /\ v_out == contents (r_out) h' b 0ul pos2 | Correct (v, v_out), IOverflow -> size (r_out) v_out > B.length b | Error s, IError s' -> s == s' | Error _, IOverflow -> (* overflow happened in implementation before specification could reach error *) True | _ -> False end ))) inline_for_extraction let extract (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) ($f_destr_spec: unit -> TWrite a r_in r_out l) : Tot (extract_t l f_destr_spec) = extract_repr_impl _ _ _ _ _ _ _ _ (destr_repr_impl f_destr_spec) inline_for_extraction let wrap_extracted_impl (#a:Type u#x) (#r_in: parser) (#r_out: parser) (l: memory_invariant) (f_destr_spec: unit -> TWrite a r_in r_out l) (e: extract_t l f_destr_spec) : TWrite a r_in r_out l = TWrite?.reflect (Repr (destr_repr_spec f_destr_spec) ( mk_repr_impl a r_in r_out (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l (destr_repr_spec f_destr_spec) (fun b len pos1 -> e b len pos1) )) let bind_spec' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match destr_repr_spec f v1 with | Error e -> Error e | Correct (x, v2) -> destr_repr_spec (g x) v2 let bind_spec2_aux (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) ($f: repr a p1 p2 inv) ($g: a -> repr b p2 p3 inv) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = match Repr?.spec f v1 with | Error e -> Error e | Correct (x, v2) -> Repr?.spec (g x) v2 let bind_spec2 (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) (v1: Parser?.t p1) : GTot (result (b & Parser?.t p3)) = bind_spec2_aux _ _ _ _ _ _ (reify (f ())) (fun x -> reify (g x ())) v1 let bind_impl' (inv: memory_invariant) (p1 p2 p3: parser) (a b: Type) (f: (unit -> TWrite a p1 p2 inv)) (g: (a -> unit -> TWrite b p2 p3 inv)) () : TWrite b p1 p3 inv = let x = f () in g x () inline_for_extraction let twrite_of_ewrite // NOTE: I could define it as a lift (sub_effect), but I prefer to do it explicitly to avoid F* generating pre and postconditions (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) (f: unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l) : TWrite a p1 p2 l = TWrite?.reflect (reify_trivial f) inline_for_extraction let wfailwith (#a: Type) (#inv: memory_invariant) (#rin #rout: parser) (s: string) : TWrite a rin rout inv = twrite_of_ewrite (fun _ -> wfailwith s) inline_for_extraction let ewrite_of_twrite (#a: Type) (#l: memory_invariant) (#p1 #p2: parser) ($f: unit -> TWrite a p1 p2 l) : EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l = EWrite?.reflect (reify (f ())) inline_for_extraction let frame (#a: Type) (#fr: parser) (#p: parser) (#l: memory_invariant) ($f: unit -> TWrite a parse_empty p l ) : TWrite a fr (fr `parse_pair` p) l = twrite_of_ewrite (fun _ -> frame' _ _ _ _ (fun _ -> ewrite_of_twrite f)) let valid_rewrite_compose (#p1: parser) (#p2: parser) (v12: squash (valid_rewrite_prop p1 p2)) (#p3: parser) (v23: squash (valid_rewrite_prop p2 p3)) : Tot (squash (valid_rewrite_prop p1 p3)) = tvalid_rewrite_of_evalid_rewrite (valid_rewrite_compose _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v12) _ _ _ (evalid_rewrite_of_tvalid_rewrite v23))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "LowParseWriters.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IndefiniteDescription.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowParseWriters.NoHoare.fst" }
[ { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "LowParseWriters", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
v: Prims.squash (LowParseWriters.NoHoare.valid_rewrite_prop p1 p2) -> LowParseWriters.NoHoare.TWrite Prims.unit
LowParseWriters.NoHoare.TWrite
[]
[]
[ "LowParseWriters.LowParse.parser", "LowParseWriters.memory_invariant", "Prims.squash", "LowParseWriters.NoHoare.valid_rewrite_prop", "LowParseWriters.NoHoare.twrite_of_ewrite", "Prims.unit", "LowParseWriters.valid_rewrite", "LowParseWriters.LowParse.__proj__Parser__item__t", "Prims.l_True", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite_f", "LowParseWriters.NoHoare.evalid_rewrite_of_tvalid_rewrite" ]
[]
false
true
false
false
false
let valid_rewrite (#p1 #p2: parser) (#inv: memory_invariant) (v: squash (valid_rewrite_prop p1 p2)) : TWrite unit p1 p2 inv =
twrite_of_ewrite (fun _ -> valid_rewrite _ _ _ _ inv (evalid_rewrite_of_tvalid_rewrite v))
false
Vale.AES.X64.AESGCM_expected_code.fst
Vale.AES.X64.AESGCM_expected_code.va_code_Loop6x_partial_expected_code
val va_code_Loop6x_partial_expected_code : alg:algorithm -> Tot va_code
val va_code_Loop6x_partial_expected_code : alg:algorithm -> Tot va_code
let va_code_Loop6x_partial_expected_code alg = (va_Block (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_CCons (va_IfElse (va_cmp_ge (va_op_cmp_reg64 rRbx) (va_const_cmp 256)) (va_Block (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 5)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 5) 1 0 (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 5)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 5) 2 0 (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_CNil ())))))))))))))))))))))))) (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CNil ()))))))) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRcx) (16 - 128) Secret) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 48 Secret) (va_CCons (va_code_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (16 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 2)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) false false) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_opr128_xmm 4)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 2)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 1) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (1 + 1) - 128) Secret) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 16 Secret)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) true true) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 64 Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (5 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (5 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (2 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (2 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64 rR9) (48 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (2 + 1) - 128) Secret) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 1)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 2)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 3)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) true true) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 80 Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR9) (64 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (3 + 1) - 128) Secret) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 2)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 3)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (4 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (4 `op_Multiply` 16) Secret false) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) true true) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 96 Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (3 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (3 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rR9) (96 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (4 + 1) - 128) Secret) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 3)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (3 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 1)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) true false) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 112 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (3 `op_Multiply` 16) Secret false) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) true true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (4 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (4 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 3)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (112 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (5 + 1) - 128) Secret) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 1)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (2 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 2)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 2) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (2 `op_Multiply` 16) Secret false) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) true true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (5 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (5 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (6 + 1) - 128) Secret) (va_CCons (va_code_VLow64ToHigh (va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 2)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 3)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 3) 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 8)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 5)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (1 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (1 `op_Multiply` 16) Secret false) (va_CCons (va_code_VSwap (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (6 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (6 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (128 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (144 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VHigh64ToLow (va_op_xmm_xmm 6) (va_op_xmm_xmm 6)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_opr128_xmm 6)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_opr128_xmm 0)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_CCons (if (alg = AES_256) then va_Block (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (176 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (208 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret) (va_CNil ()))))))))))))))))))))))))))))) else va_Block (va_CNil ())) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 15)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret) (va_CCons (va_code_VSwap (va_op_xmm_xmm 8) (va_op_xmm_xmm 4)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 4) (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 15)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 1) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_CNil ()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
{ "file_name": "obj/Vale.AES.X64.AESGCM_expected_code.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 184, "end_line": 301, "start_col": 0, "start_line": 40 }
module Vale.AES.X64.AESGCM_expected_code open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Types_s open FStar.Seq open Vale.AES.AES_s open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.InsAes open Vale.X64.QuickCode open Vale.X64.QuickCodes open Vale.Arch.Types open Vale.AES.AES_helpers //open Vale.Poly1305.Math // For lemma_poly_bits64() open Vale.AES.GCM_helpers open Vale.AES.GCTR_s open Vale.AES.GCTR open Vale.Arch.TypesNative open Vale.X64.CPU_Features_s open Vale.AES.X64.PolyOps open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.AES.GHash open Vale.AES.X64.AESopt2 #reset-options "--z3rlimit 50" //-- Loop6x_partial_expected_code
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.InsAes.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.X64.PolyOps.fsti.checked", "Vale.AES.X64.AESopt2.fsti.checked", "Vale.AES.GHash.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "Vale.AES.GCTR_s.fst.checked", "Vale.AES.GCTR.fsti.checked", "Vale.AES.GCM_helpers.fsti.checked", "Vale.AES.AES_s.fst.checked", "Vale.AES.AES_helpers.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.X64.AESGCM_expected_code.fst" }
[ { "abbrev": false, "full_module": "Vale.AES.X64.AESopt2", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash", "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.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsAes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
alg: Vale.AES.AES_common_s.algorithm -> Vale.X64.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Vale.AES.AES_common_s.algorithm", "Vale.X64.Decls.va_Block", "Vale.X64.Decls.va_CCons", "Vale.X64.InsBasic.va_code_Add64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rRbx", "Vale.X64.Decls.va_const_opr64", "Vale.X64.Decls.va_IfElse", "Vale.X64.Decls.va_cmp_ge", "Vale.X64.Decls.va_op_cmp_reg64", "Vale.X64.Decls.va_const_cmp", "Vale.X64.InsVector.va_code_InitPshufbMask", "Vale.X64.Decls.va_op_xmm_xmm", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.X64.Machine_s.rR11", "Vale.X64.InsVector.va_code_VPshufb", "Vale.X64.InsVector.va_code_ZeroXmm", "Vale.X64.InsVector.va_code_PinsrqImm", "Vale.X64.InsVector.va_code_VPaddd", "Vale.X64.InsVector.va_code_Load128_buffer", "Vale.X64.Decls.va_op_heaplet_mem_heaplet", "Vale.X64.Machine_s.rR9", "Prims.op_Subtraction", "Vale.Arch.HeapTypes_s.Secret", "Vale.X64.InsVector.va_code_VPxor", "Vale.X64.Decls.va_op_opr128_xmm", "Vale.X64.InsBasic.va_code_Sub64", "Vale.X64.Decls.va_CNil", "Vale.X64.InsVector.va_code_Store128_buffer", "Vale.X64.Machine_s.rRbp", "Vale.AES.X64.PolyOps.va_code_VPolyMul", "Vale.X64.Machine_s.rRcx", "Vale.X64.InsAes.va_code_VAESNI_enc", "Vale.AES.X64.PolyOps.va_code_VPolyAdd", "Prims.op_Multiply", "Prims.op_Addition", "Vale.X64.InsVector.va_code_Mem128_lemma", "Vale.X64.Decls.va_opr_code_Mem128", "Vale.X64.Decls.va_op_reg64_reg64", "Vale.X64.InsVector.va_code_LoadBe64_buffer128", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR12", "Vale.X64.InsVector.va_code_Store64_buffer128", "Vale.AES.X64.PolyOps.va_code_VLow64ToHigh", "Vale.AES.X64.PolyOps.va_code_VSwap", "Vale.AES.X64.PolyOps.va_code_VHigh64ToLow", "Prims.op_Equality", "Vale.AES.AES_common_s.AES_256", "Prims.bool", "Vale.X64.Decls.va_code", "Vale.X64.Machine_s.rRdi" ]
[]
false
false
false
true
false
let va_code_Loop6x_partial_expected_code alg =
(va_Block (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_CCons (va_IfElse (va_cmp_ge (va_op_cmp_reg64 rRbx) (va_const_cmp 256)) (va_Block (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 5)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 5) 1 0 (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 5)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 5) 2 0 (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15 )) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 14 ) (va_op_xmm_xmm 12 ) (va_op_xmm_xmm 5 )) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1 ) (va_op_xmm_xmm 13 ) (va_op_xmm_xmm 5 )) (va_CCons (va_code_VPshufb ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 0 ) ) (va_CCons ( va_code_VPshufb ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 0 ) ) ( va_CCons ( va_code_VPshufb ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 0 ) ) ( va_CCons ( va_code_Sub64 ( va_op_dst_opr64_reg64 rRbx ) ( va_const_opr64 256 ) ) ( va_CNil () ) ) ) )) )))))))))))) ))))))) (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CNil ()))))))) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false true) (va_CCons (va_code_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRcx) (16 - 128) Secret) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 48 Secret) (va_CCons (va_code_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 1) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) false false) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 7 ) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) true true) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (16 - 32) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 2)) (va_CCons (va_code_VPolyAdd ( va_op_xmm_xmm 6) (va_op_xmm_xmm 6) (va_op_opr128_xmm 5) ) (va_CCons (va_code_VPolyMul (va_op_xmm_xmm 5 ) (va_op_xmm_xmm 0 ) (va_op_xmm_xmm 3 ) false false) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_opr128_xmm 4)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 2)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 4 ) (va_op_xmm_xmm 1 ) (va_op_opr128_xmm 5 )) (va_CCons (va_code_VPolyMul ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 3 ) false true ) (va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 2 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 1 + 1 ) - 128 ) Secret ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 3 ) true false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Mem128_lemma () ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 8 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg64_reg64 rRbp ) 16 Secret ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 3 ) true true ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 3 ) ( va_op_xmm_xmm 0 ) ( va_op_reg_opr64_reg64 rRbp ) 64 Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 5 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 5 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 2 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 2 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 5 ) ( va_op_reg_opr64_reg64 rR9 ) ( 48 - 32 ) Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 2 + 1 ) - 128 ) Secret ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 1 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 5 ) false false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 2 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 5 ) false true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 3 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 5 ) true false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 5 ) true true ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 3 ) ( va_op_xmm_xmm 0 ) ( va_op_reg_opr64_reg64 rRbp ) 80 Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 1 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rR9 ) ( 64 - 32 ) Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 3 + 1 ) - 128 ) Secret ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 2 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) false false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 3 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) false true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 4 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 5 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) true false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 4 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) true true ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 3 ) ( va_op_xmm_xmm 0 ) ( va_op_reg_opr64_reg64 rRbp ) 96 Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 3 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 3 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 2 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 2 ) ( va_op_reg_opr64_reg64 rR9 ) ( 96 - 32 ) Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 4 + 1 ) - 128 ) Secret ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 3 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 2 ) false false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 5 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 2 ) false true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 3 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 1 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 2 ) true false ) ( va_CCons ( va_code_Mem128_lemma () ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 8 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg64_reg64 rRbp ) 112 Secret ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 3 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 2 ) true true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 4 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 4 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 3 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 3 ) ( va_op_reg_opr64_reg64 rR9 ) ( 112 - 32 ) Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 5 + 1 ) - 128 ) Secret ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 5 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 3 ) false true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 1 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 1 ) ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 3 ) true false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 2 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 2 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 3 ) false false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 2 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 3 ) true true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 5 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 5 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 5 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ( va_op_opr128_xmm 1 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 16 `op_Multiply` ( 6 + 1 ) - 128 ) Secret ) ( va_CCons ( va_code_VLow64ToHigh ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 6 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 2 ) ) ( va_CCons ( va_code_ZeroXmm ( va_op_xmm_xmm 3 ) ) ( va_CCons ( va_code_PinsrqImm ( va_op_xmm_xmm 3 ) 13979173243358019584 1 ( va_op_reg_opr64_reg64 rR11 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 8 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 5 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 1 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 1 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VSwap ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 4 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 3 ) false true ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR13 ) ( 6 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store64_buffer128 ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_reg_opr64_reg64 rR12 ) ( 6 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 128 - 128 ) Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 144 - 128 ) Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VHigh64ToLow ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 6 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 7 ) ( va_op_opr128_xmm 6 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VPolyAdd ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_opr128_xmm 0 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 0 `op_Multiply` 16 + 8 ) Secret true ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 0 `op_Multiply` 16 ) Secret false ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 160 - 128 ) Secret ) ( va_CCons ( if ( alg = AES_256 ) then va_Block ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 176 - 128 ) Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 192 - 128 ) Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 15 ) ( va_op_reg_opr64_reg64 rRcx ) ( 208 - 128 ) Secret ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 1 ) ) ( va_CCons ( va_code_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 224 - 128 ) Secret ) ( va_CNil () ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) else va_Block ( va_CNil () ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Store128_buffer ( va_op_heaplet_mem_heaplet 3 ) ( va_op_reg_opr64_reg64 rRbp ) ( va_op_xmm_xmm 7 ) 16 Secret ) ( va_CCons ( va_code_VSwap ( va_op_xmm_xmm 8 ) ( va_op_xmm_xmm 4 ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_VPolyMul ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 4 ) ( va_op_xmm_xmm 3 ) false true ) ( va_CCons ( va_code_Mem128_lemma () ) ( va_CCons ( va_code_VPxor ( va_op_xmm_xmm 2 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 0 Secret ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Mem128_lemma () ) ( va_CCons ( va_code_VPxor ( va_op_xmm_xmm 0 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 16 Secret ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Mem128_lemma () ) ( va_CCons ( va_code_VPxor ( va_op_xmm_xmm 5 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 32 Secret ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Mem128_lemma () ) ( va_CCons ( va_code_VPxor ( va_op_xmm_xmm 6 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 48 Secret ) ) ( va_CCons ( va_code_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 15 ) ) ( va_CCons ( va_code_Mem128_lemma () ) ( va_CCons ( va_code_VPxor ( va_op_xmm_xmm 7 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 64 Secret ) ) ( va_CCons ( va_code_Mem128_lemma () ) ( va_CCons ( va_code_VPxor ( va_op_xmm_xmm 3 ) ( va_op_xmm_xmm 1 ) ( va_opr_code_Mem128 ( va_op_heaplet_mem_heaplet 1 ) ( va_op_reg64_reg64 rRdi ) 80 Secret ) ) ( va_CNil () ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )) )))))))))))) )))))))))))
false
Steel.ST.SeqMatch.fst
Steel.ST.SeqMatch.seq_seq_match_weaken_with_implies
val seq_seq_match_weaken_with_implies (#opened: _) (#t1 #t2: Type) (p: (t1 -> t2 -> vprop)) (c1 c1': Seq.seq t1) (c2 c2': Seq.seq t2) (i j: nat) : STGhost unit opened (seq_seq_match p c1 c2 i j) (fun _ -> (seq_seq_match p c1' c2' i j) `star` ((seq_seq_match p c1' c2' i j) `implies_` (seq_seq_match p c1 c2 i j))) (i <= j /\ (i == j \/ (j <= Seq.length c1 /\ j <= Seq.length c2 /\ j <= Seq.length c1' /\ j <= Seq.length c2' /\ (Seq.slice c1 i j) `Seq.equal` (Seq.slice c1' i j) /\ (Seq.slice c2 i j) `Seq.equal` (Seq.slice c2' i j)))) (fun _ -> True)
val seq_seq_match_weaken_with_implies (#opened: _) (#t1 #t2: Type) (p: (t1 -> t2 -> vprop)) (c1 c1': Seq.seq t1) (c2 c2': Seq.seq t2) (i j: nat) : STGhost unit opened (seq_seq_match p c1 c2 i j) (fun _ -> (seq_seq_match p c1' c2' i j) `star` ((seq_seq_match p c1' c2' i j) `implies_` (seq_seq_match p c1 c2 i j))) (i <= j /\ (i == j \/ (j <= Seq.length c1 /\ j <= Seq.length c2 /\ j <= Seq.length c1' /\ j <= Seq.length c2' /\ (Seq.slice c1 i j) `Seq.equal` (Seq.slice c1' i j) /\ (Seq.slice c2 i j) `Seq.equal` (Seq.slice c2' i j)))) (fun _ -> True)
let seq_seq_match_weaken_with_implies (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c1 c1': Seq.seq t1) (c2 c2': Seq.seq t2) (i j: nat) : STGhost unit opened (seq_seq_match p c1 c2 i j) (fun _ -> seq_seq_match p c1' c2' i j `star` (seq_seq_match p c1' c2' i j `implies_` seq_seq_match p c1 c2 i j) ) (i <= j /\ (i == j \/ ( j <= Seq.length c1 /\ j <= Seq.length c2 /\ j <= Seq.length c1' /\ j <= Seq.length c2' /\ Seq.slice c1 i j `Seq.equal` Seq.slice c1' i j /\ Seq.slice c2 i j `Seq.equal` Seq.slice c2' i j ))) (fun _ -> True) = seq_seq_match_weaken p p (fun _ _ -> noop ()) c1 c1' c2 c2' i j; intro_implies (seq_seq_match p c1' c2' i j) (seq_seq_match p c1 c2 i j) emp (fun _ -> seq_seq_match_weaken p p (fun _ _ -> noop ()) c1' c1 c2' c2 i j )
{ "file_name": "lib/steel/Steel.ST.SeqMatch.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 5, "end_line": 326, "start_col": 0, "start_line": 292 }
module Steel.ST.SeqMatch include Steel.ST.OnRange open Steel.ST.GenElim module Seq = FStar.Seq module SZ = FStar.SizeT (* `seq_list_match` describes how to match a sequence of low-level values (the low-level contents of an array) with a list of high-level values. `seq_list_match` is carefully designed to be usable within (mutually) recursive definitions of matching functions on the type of high-level values. *) [@@__reduce__] let seq_list_match_nil0 (#t: Type) (c: Seq.seq t) : Tot vprop = pure (c `Seq.equal` Seq.empty) [@@__reduce__] let seq_list_match_cons0 (#t #t': Type) (c: Seq.seq t) (l: list t' { Cons? l }) (item_match: (t -> (v': t' { v' << l }) -> vprop)) (seq_list_match: (Seq.seq t -> (v': list t') -> (raw_data_item_match: (t -> (v'': t' { v'' << v' }) -> vprop) { v' << l }) -> vprop)) : Tot vprop = exists_ (fun (c1: t) -> exists_ (fun (c2: Seq.seq t) -> item_match c1 (List.Tot.hd l) `star` seq_list_match c2 (List.Tot.tl l) item_match `star` pure (c `Seq.equal` Seq.cons c1 c2) )) let rec seq_list_match (#t #t': Type) (c: Seq.seq t) (v: list t') (item_match: (t -> (v': t' { v' << v }) -> vprop)) : Tot vprop (decreases v) = if Nil? v then seq_list_match_nil0 c else seq_list_match_cons0 c v item_match seq_list_match let seq_list_match_cons_eq (#t #t': Type) (c: Seq.seq t) (v: list t') (item_match: (t -> (v': t' { v' << v }) -> vprop)) : Lemma (requires (Cons? v)) (ensures ( seq_list_match c v item_match == seq_list_match_cons0 c v item_match seq_list_match )) = let a :: q = v in assert_norm (seq_list_match c (a :: q) item_match == seq_list_match_cons0 c (a :: q) item_match seq_list_match ) let seq_list_match_nil (#opened: _) (#t #t': Type) (c: Seq.seq t) (v: list t') (item_match: (t -> (v': t' { v' << v }) -> vprop)) : STGhost unit opened emp (fun _ -> seq_list_match c v item_match) (c `Seq.equal` Seq.empty /\ Nil? v) (fun _ -> True) = noop (); rewrite (seq_list_match_nil0 c) (seq_list_match c v item_match) let list_cons_precedes (#t: Type) (a: t) (q: list t) : Lemma ((a << a :: q) /\ (q << a :: q)) [SMTPat (a :: q)] = assert (List.Tot.hd (a :: q) << (a :: q)); assert (List.Tot.tl (a :: q) << (a :: q)) let seq_list_match_cons_intro (#opened: _) (#t #t': Type) (a: t) (a' : t') (c: Seq.seq t) (v: list t') (item_match: (t -> (v': t' { v' << a' :: v }) -> vprop)) : STGhostT unit opened (item_match a a' `star` seq_list_match c v item_match) (fun _ -> seq_list_match (Seq.cons a c) (a' :: v) item_match) = seq_list_match_cons_eq (Seq.cons a c) (a' :: v) item_match; noop (); rewrite (seq_list_match_cons0 (Seq.cons a c) (a' :: v) item_match seq_list_match) (seq_list_match (Seq.cons a c) (a' :: v) item_match) let seq_list_match_cons_elim (#opened: _) (#t #t': Type) (c: Seq.seq t) (v: list t' { Cons? v \/ Seq.length c > 0 }) (item_match: (t -> (v': t' { v' << v }) -> vprop)) : STGhostT (squash (Cons? v /\ Seq.length c > 0)) opened (seq_list_match c v item_match) (fun _ -> item_match (Seq.head c) (List.Tot.hd v) `star` seq_list_match (Seq.tail c) (List.Tot.tl v) item_match) = if Nil? v then begin rewrite (seq_list_match c v item_match) (seq_list_match_nil0 c); let _ = gen_elim () in assert False; rewrite // by contradiction emp (item_match (Seq.head c) (List.Tot.hd v) `star` seq_list_match (Seq.tail c) (List.Tot.tl v) item_match) end else begin seq_list_match_cons_eq c v item_match; noop (); rewrite (seq_list_match c v item_match) (seq_list_match_cons0 c v item_match seq_list_match); let _ = gen_elim () in let prf : squash (Cons? v /\ Seq.length c > 0) = () in let c1 = vpattern (fun c1 -> item_match c1 (List.Tot.hd v)) in let c2 = vpattern (fun c2 -> seq_list_match c2 (List.Tot.tl v) item_match) in Seq.lemma_cons_inj c1 (Seq.head c) c2 (Seq.tail c); vpattern_rewrite (fun c1 -> item_match c1 (List.Tot.hd v)) (Seq.head c); vpattern_rewrite (fun c2 -> seq_list_match c2 (List.Tot.tl v) item_match) (Seq.tail c); prf end // this one cannot be proven with seq_seq_match because of the << refinement in the type of item_match let rec seq_list_match_weaken (#opened: _) (#t #t': Type) (c: Seq.seq t) (v: list t') (item_match1 item_match2: (t -> (v': t' { v' << v }) -> vprop)) (prf: ( (#opened: _) -> (c': t) -> (v': t' { v' << v }) -> STGhostT unit opened (item_match1 c' v') (fun _ -> item_match2 c' v') )) : STGhostT unit opened (seq_list_match c v item_match1) (fun _ -> seq_list_match c v item_match2) (decreases v) = if Nil? v then rewrite (seq_list_match c v item_match1) (seq_list_match c v item_match2) else begin let _ : squash (Cons? v) = () in seq_list_match_cons_eq c v item_match1; seq_list_match_cons_eq c v item_match2; rewrite (seq_list_match c v item_match1) (seq_list_match_cons0 c v item_match1 seq_list_match); let _ = gen_elim () in prf _ _; seq_list_match_weaken _ (List.Tot.tl v) item_match1 item_match2 prf; rewrite (seq_list_match_cons0 c v item_match2 seq_list_match) (seq_list_match c v item_match2) end (* `seq_seq_match` describes how to match a sequence of low-level values (the low-level contents of an array) with a sequence of high-level values. Contrary to `seq_list_match`, `seq_seq_match` is not meant to be usable within (mutually) recursive definitions of matching functions on the type of high-level values, because no lemma ensures that `Seq.index s i << s` *) let seq_seq_match_item (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: Seq.seq t2) (i: nat) : Tot vprop = if i < Seq.length c && i < Seq.length l then p (Seq.index c i) (Seq.index l i) else pure (squash False) let seq_seq_match_item_tail (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: Seq.seq t2) (delta: nat) (i: nat) : Lemma (requires ( i + delta <= Seq.length c /\ i + delta <= Seq.length l )) (ensures ( seq_seq_match_item p (Seq.slice c delta (Seq.length c)) (Seq.slice l delta (Seq.length l)) i == seq_seq_match_item p c l (i + delta) )) = () [@@__reduce__] let seq_seq_match (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (c: Seq.seq t1) (l: Seq.seq t2) (i j: nat) : Tot vprop = on_range (seq_seq_match_item p c l) i j let seq_seq_match_length (#opened: _) (#t1 #t2: Type) (p: t1 -> t2 -> vprop) (s1: Seq.seq t1) (s2: Seq.seq t2) (i j: nat) : STGhost unit opened (seq_seq_match p s1 s2 i j) (fun _ -> seq_seq_match p s1 s2 i j) True (fun _ -> i <= j /\ (i == j \/ (j <= Seq.length s1 /\ j <= Seq.length s2))) = on_range_le (seq_seq_match_item p s1 s2) i j; if i = j then noop () else begin let j' = j - 1 in if j' < Seq.length s1 && j' < Seq.length s2 then noop () else begin on_range_unsnoc (seq_seq_match_item p s1 s2) i j' j; rewrite (seq_seq_match_item p _ _ _) (pure (squash False)); let _ = gen_elim () in rewrite (seq_seq_match p s1 s2 i j') (seq_seq_match p s1 s2 i j) // by contradiction end end let seq_seq_match_weaken (#opened: _) (#t1 #t2: Type) (p p': t1 -> t2 -> vprop) (w: ((x1: t1) -> (x2: t2) -> STGhostT unit opened (p x1 x2) (fun _ -> p' x1 x2) )) (c1 c1': Seq.seq t1) (c2 c2': Seq.seq t2) (i j: nat) : STGhost unit opened (seq_seq_match p c1 c2 i j) (fun _ -> seq_seq_match p' c1' c2' i j) (i <= j /\ (i == j \/ ( j <= Seq.length c1 /\ j <= Seq.length c2 /\ j <= Seq.length c1' /\ j <= Seq.length c2' /\ Seq.slice c1 i j `Seq.equal` Seq.slice c1' i j /\ Seq.slice c2 i j `Seq.equal` Seq.slice c2' i j ))) (fun _ -> True) = on_range_weaken (seq_seq_match_item p c1 c2) (seq_seq_match_item p' c1' c2') i j (fun k -> rewrite (seq_seq_match_item p c1 c2 k) (p (Seq.index (Seq.slice c1 i j) (k - i)) (Seq.index (Seq.slice c2 i j) (k - i))); w _ _; rewrite (p' _ _) (seq_seq_match_item p' c1' c2' k) )
{ "checked_file": "/", "dependencies": [ "Steel.ST.OnRange.fsti.checked", "Steel.ST.GenElim.fsti.checked", "prims.fst.checked", "FStar.SizeT.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Steel.ST.SeqMatch.fst" }
[ { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "SZ" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": false, "full_module": "Steel.ST.GenElim", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST.OnRange", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: (_: t1 -> _: t2 -> Steel.Effect.Common.vprop) -> c1: FStar.Seq.Base.seq t1 -> c1': FStar.Seq.Base.seq t1 -> c2: FStar.Seq.Base.seq t2 -> c2': FStar.Seq.Base.seq t2 -> i: Prims.nat -> j: Prims.nat -> Steel.ST.Effect.Ghost.STGhost Prims.unit
Steel.ST.Effect.Ghost.STGhost
[]
[]
[ "Steel.Memory.inames", "Steel.Effect.Common.vprop", "FStar.Seq.Base.seq", "Prims.nat", "Steel.ST.Util.intro_implies", "Steel.ST.SeqMatch.seq_seq_match", "Steel.Effect.Common.emp", "Steel.ST.SeqMatch.seq_seq_match_weaken", "Steel.ST.Util.noop", "Prims.unit", "Steel.Effect.Common.star", "Steel.ST.Util.implies_", "FStar.Ghost.hide", "FStar.Set.set", "Steel.Memory.iname", "FStar.Set.empty", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.l_or", "Prims.eq2", "FStar.Seq.Base.length", "FStar.Seq.Base.equal", "FStar.Seq.Base.slice", "Prims.l_True" ]
[]
false
true
false
false
false
let seq_seq_match_weaken_with_implies (#opened: _) (#t1 #t2: Type) (p: (t1 -> t2 -> vprop)) (c1 c1': Seq.seq t1) (c2 c2': Seq.seq t2) (i j: nat) : STGhost unit opened (seq_seq_match p c1 c2 i j) (fun _ -> (seq_seq_match p c1' c2' i j) `star` ((seq_seq_match p c1' c2' i j) `implies_` (seq_seq_match p c1 c2 i j))) (i <= j /\ (i == j \/ (j <= Seq.length c1 /\ j <= Seq.length c2 /\ j <= Seq.length c1' /\ j <= Seq.length c2' /\ (Seq.slice c1 i j) `Seq.equal` (Seq.slice c1' i j) /\ (Seq.slice c2 i j) `Seq.equal` (Seq.slice c2' i j)))) (fun _ -> True) =
seq_seq_match_weaken p p (fun _ _ -> noop ()) c1 c1' c2 c2' i j; intro_implies (seq_seq_match p c1' c2' i j) (seq_seq_match p c1 c2 i j) emp (fun _ -> seq_seq_match_weaken p p (fun _ _ -> noop ()) c1' c1 c2' c2 i j)
false
Spec.Chacha20Poly1305.fst
Spec.Chacha20Poly1305.size_key
val size_key:size_nat
val size_key:size_nat
let size_key : size_nat = 32
{ "file_name": "specs/Spec.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 15, "start_col": 0, "start_line": 15 }
module Spec.Chacha20Poly1305 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence module Poly = Spec.Poly1305 (* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *) #set-options "--max_fuel 0 --z3rlimit 30" /// Constants
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "Poly" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat{n <= Prims.pow2 32 - 1}
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
false
false
let size_key:size_nat =
32
false
Spec.Chacha20Poly1305.fst
Spec.Chacha20Poly1305.size_block
val size_block:size_nat
val size_block:size_nat
let size_block : size_nat = Poly.size_block
{ "file_name": "specs/Spec.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 43, "end_line": 17, "start_col": 0, "start_line": 17 }
module Spec.Chacha20Poly1305 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence module Poly = Spec.Poly1305 (* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *) #set-options "--max_fuel 0 --z3rlimit 30" /// Constants let size_key : size_nat = 32 (* in bytes *)
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "Poly" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat{n <= Prims.pow2 32 - 1}
Prims.Tot
[ "total" ]
[]
[ "Spec.Poly1305.size_block" ]
[]
false
false
false
false
false
let size_block:size_nat =
Poly.size_block
false
Spec.Chacha20Poly1305.fst
Spec.Chacha20Poly1305.size_nonce
val size_nonce:size_nat
val size_nonce:size_nat
let size_nonce : size_nat = 12
{ "file_name": "specs/Spec.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 16, "start_col": 0, "start_line": 16 }
module Spec.Chacha20Poly1305 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence module Poly = Spec.Poly1305 (* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *) #set-options "--max_fuel 0 --z3rlimit 30" /// Constants
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "Poly" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat{n <= Prims.pow2 32 - 1}
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
false
false
let size_nonce:size_nat =
12
false
Spec.Chacha20Poly1305.fst
Spec.Chacha20Poly1305.size_tag
val size_tag:size_nat
val size_tag:size_nat
let size_tag : size_nat = size_block
{ "file_name": "specs/Spec.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 36, "end_line": 18, "start_col": 0, "start_line": 18 }
module Spec.Chacha20Poly1305 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence module Poly = Spec.Poly1305 (* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *) #set-options "--max_fuel 0 --z3rlimit 30" /// Constants let size_key : size_nat = 32 (* in bytes *) let size_nonce : size_nat = 12 (* in bytes *)
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "Poly" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat{n <= Prims.pow2 32 - 1}
Prims.Tot
[ "total" ]
[]
[ "Spec.Chacha20Poly1305.size_block" ]
[]
false
false
false
false
false
let size_tag:size_nat =
size_block
false
Hacl.Impl.Chacha20Poly1305.fst
Hacl.Impl.Chacha20Poly1305.width_chacha20
val width_chacha20 (s: field_spec) : Hacl.Spec.Chacha20.Vec.lanes
val width_chacha20 (s: field_spec) : Hacl.Spec.Chacha20.Vec.lanes
let width_chacha20 (s:field_spec) : Hacl.Spec.Chacha20.Vec.lanes = match s with | M32 -> 1 | M128 -> 4 | M256 -> 8
{ "file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 13, "end_line": 111, "start_col": 0, "start_line": 107 }
module Hacl.Impl.Chacha20Poly1305 open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Hacl.Impl.Chacha20Poly1305.PolyCore open Hacl.Impl.Poly1305.Fields module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BSeq = Lib.ByteSequence module Spec = Spec.Chacha20Poly1305 module SpecPoly = Spec.Poly1305 module Poly = Hacl.Impl.Poly1305 #reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options" val poly1305_do_: #w:field_spec -> k:lbuffer uint8 32ul // key -> aadlen:size_t -> aad:lbuffer uint8 aadlen // authenticated additional data -> mlen:size_t -> m:lbuffer uint8 mlen // plaintext -> ctx:Poly.poly1305_ctx w -> block:lbuffer uint8 16ul -> Stack unit (requires fun h -> live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\ disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\ disjoint block k /\ disjoint block aad /\ disjoint block m) (ensures fun h0 _ h1 -> modifies (loc ctx |+| loc block) h0 h1 /\ (let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad))) (BSeq.uint_to_bytes_le #U64 (u64 (length m))) in let acc = SpecPoly.poly1305_update1 r 16 block_s acc in Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\ Poly.state_inv_t h1 ctx)) [@Meta.Attribute.inline_] let poly1305_do_ #w k aadlen aad mlen m ctx block = Poly.poly1305_init ctx k; if (aadlen <> 0ul) then ( poly1305_padded ctx aadlen aad) else (); if (mlen <> 0ul) then ( poly1305_padded ctx mlen m) else (); let h0 = ST.get () in update_sub_f h0 block 0ul 8ul (fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen)); let h1 = ST.get () in //assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)); Poly.reveal_ctx_inv ctx h0 h1; update_sub_f h1 block 8ul 8ul (fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen)); let h2 = ST.get () in //assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen)); LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)); LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block); //assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen))); Poly.reveal_ctx_inv ctx h1 h2; Poly.poly1305_update1 ctx block // Implements the actual poly1305_do operation inline_for_extraction noextract let poly1305_do_core_st (w:field_spec) = k:lbuffer uint8 32ul // key -> aadlen:size_t -> aad:lbuffer uint8 aadlen // authenticated additional data -> mlen:size_t -> m:lbuffer uint8 mlen // plaintext -> out:lbuffer uint8 16ul -> // output: tag Stack unit (requires fun h -> live h k /\ live h aad /\ live h m /\ live h out /\ disjoint k out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad)) noextract val poly1305_do: #w:field_spec -> poly1305_do_core_st w [@Meta.Attribute.specialize] let poly1305_do #w k aadlen aad mlen m out = push_frame(); let ctx = create (nlimb w +! precomplen w) (limb_zero w) in let block = create 16ul (u8 0) in poly1305_do_ #w k aadlen aad mlen m ctx block; Poly.poly1305_finish out k ctx; pop_frame()
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Meta.Attribute.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Chacha20.Vec.fst.checked", "Hacl.Impl.Poly1305.Fields.fst.checked", "Hacl.Impl.Poly1305.fsti.checked", "Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked", "Hacl.Impl.Chacha20.Vec.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Poly1305", "short_module": "Poly" }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "SpecPoly" }, { "abbrev": true, "full_module": "Spec.Chacha20Poly1305", "short_module": "Spec" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Poly1305.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 150, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: Hacl.Impl.Poly1305.Fields.field_spec -> Hacl.Spec.Chacha20.Vec.lanes
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Poly1305.Fields.field_spec", "Hacl.Spec.Chacha20.Vec.lanes" ]
[]
false
false
false
true
false
let width_chacha20 (s: field_spec) : Hacl.Spec.Chacha20.Vec.lanes =
match s with | M32 -> 1 | M128 -> 4 | M256 -> 8
false
Hacl.Impl.Chacha20Poly1305.fst
Hacl.Impl.Chacha20Poly1305.poly1305_do_core_st
val poly1305_do_core_st : w: Hacl.Impl.Poly1305.Fields.field_spec -> Type0
let poly1305_do_core_st (w:field_spec) = k:lbuffer uint8 32ul // key -> aadlen:size_t -> aad:lbuffer uint8 aadlen // authenticated additional data -> mlen:size_t -> m:lbuffer uint8 mlen // plaintext -> out:lbuffer uint8 16ul -> // output: tag Stack unit (requires fun h -> live h k /\ live h aad /\ live h m /\ live h out /\ disjoint k out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad))
{ "file_name": "code/chacha20poly1305/Hacl.Impl.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 82, "end_line": 91, "start_col": 0, "start_line": 78 }
module Hacl.Impl.Chacha20Poly1305 open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Hacl.Impl.Chacha20Poly1305.PolyCore open Hacl.Impl.Poly1305.Fields module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BSeq = Lib.ByteSequence module Spec = Spec.Chacha20Poly1305 module SpecPoly = Spec.Poly1305 module Poly = Hacl.Impl.Poly1305 #reset-options "--z3rlimit 150 --max_fuel 0 --max_ifuel 1 --record_options" val poly1305_do_: #w:field_spec -> k:lbuffer uint8 32ul // key -> aadlen:size_t -> aad:lbuffer uint8 aadlen // authenticated additional data -> mlen:size_t -> m:lbuffer uint8 mlen // plaintext -> ctx:Poly.poly1305_ctx w -> block:lbuffer uint8 16ul -> Stack unit (requires fun h -> live h k /\ live h aad /\ live h m /\ live h ctx /\ live h block /\ disjoint ctx k /\ disjoint ctx aad /\ disjoint ctx m /\ disjoint ctx block /\ disjoint block k /\ disjoint block aad /\ disjoint block m) (ensures fun h0 _ h1 -> modifies (loc ctx |+| loc block) h0 h1 /\ (let acc, r = SpecPoly.poly1305_init (as_seq h0 k) in let acc = if (length aad <> 0) then Spec.poly1305_padded r (as_seq h0 aad) acc else acc in let acc = if (length m <> 0) then Spec.poly1305_padded r (as_seq h0 m) acc else acc in let block_s = LSeq.concat (BSeq.uint_to_bytes_le #U64 (u64 (length aad))) (BSeq.uint_to_bytes_le #U64 (u64 (length m))) in let acc = SpecPoly.poly1305_update1 r 16 block_s acc in Poly.as_get_acc h1 ctx == acc /\ as_seq h1 block == block_s /\ Poly.state_inv_t h1 ctx)) [@Meta.Attribute.inline_] let poly1305_do_ #w k aadlen aad mlen m ctx block = Poly.poly1305_init ctx k; if (aadlen <> 0ul) then ( poly1305_padded ctx aadlen aad) else (); if (mlen <> 0ul) then ( poly1305_padded ctx mlen m) else (); let h0 = ST.get () in update_sub_f h0 block 0ul 8ul (fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (fun _ -> uint_to_bytes_le (sub block 0ul 8ul) (to_u64 aadlen)); let h1 = ST.get () in //assert (LSeq.sub (as_seq h1 block) 0 8 == BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)); Poly.reveal_ctx_inv ctx h0 h1; update_sub_f h1 block 8ul 8ul (fun h -> BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (fun _ -> uint_to_bytes_le (sub block 8ul 8ul) (to_u64 mlen)); let h2 = ST.get () in //assert (LSeq.sub (as_seq h2 block) 8 8 == BSeq.uint_to_bytes_le #U64 (to_u64 mlen)); LSeq.eq_intro (LSeq.sub (as_seq h2 block) 0 8) (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)); LSeq.lemma_concat2 8 (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) 8 (BSeq.uint_to_bytes_le #U64 (to_u64 mlen)) (as_seq h2 block); //assert (as_seq h2 block == LSeq.concat (BSeq.uint_to_bytes_le #U64 (to_u64 aadlen)) (BSeq.uint_to_bytes_le #U64 (to_u64 mlen))); Poly.reveal_ctx_inv ctx h1 h2; Poly.poly1305_update1 ctx block // Implements the actual poly1305_do operation
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Meta.Attribute.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Chacha20.Vec.fst.checked", "Hacl.Impl.Poly1305.Fields.fst.checked", "Hacl.Impl.Poly1305.fsti.checked", "Hacl.Impl.Chacha20Poly1305.PolyCore.fst.checked", "Hacl.Impl.Chacha20.Vec.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Poly1305", "short_module": "Poly" }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "SpecPoly" }, { "abbrev": true, "full_module": "Spec.Chacha20Poly1305", "short_module": "Spec" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Poly1305.Fields", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Chacha20Poly1305.PolyCore", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 150, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
w: Hacl.Impl.Poly1305.Fields.field_spec -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Poly1305.Fields.field_spec", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.size_t", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.disjoint", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "Lib.Sequence.lseq", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.as_seq", "Spec.Chacha20Poly1305.poly1305_do" ]
[]
false
false
false
true
true
let poly1305_do_core_st (w: field_spec) =
k: lbuffer uint8 32ul -> aadlen: size_t -> aad: lbuffer uint8 aadlen -> mlen: size_t -> m: lbuffer uint8 mlen -> out: lbuffer uint8 16ul -> Stack unit (requires fun h -> live h k /\ live h aad /\ live h m /\ live h out /\ disjoint k out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.poly1305_do (as_seq h0 k) (as_seq h0 m) (as_seq h0 aad))
false
L0Types.fst
L0Types.x509_version_t
val x509_version_t : Type0
val x509_version_t : Type0
let x509_version_t : Type0 = UInt32.t
{ "file_name": "share/steel/examples/pulse/dice/l0/L0Types.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 37, "end_line": 20, "start_col": 0, "start_line": 20 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module L0Types open Pulse.Lib.Pervasives
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Pervasives.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "L0Types.fst" }
[ { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "HACL", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "US" }, { "abbrev": true, "full_module": "Pulse.Lib.Vec", "short_module": "V" }, { "abbrev": true, "full_module": "Pulse.Lib.Reference", "short_module": "R" }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt32.t" ]
[]
false
false
false
true
true
let x509_version_t:Type0 =
UInt32.t
false
Spec.Chacha20Poly1305.fst
Spec.Chacha20Poly1305.poly1305_padded
val poly1305_padded: r_elem:Poly.felem -> text:bytes -> acc:Poly.felem -> Tot Poly.felem
val poly1305_padded: r_elem:Poly.felem -> text:bytes -> acc:Poly.felem -> Tot Poly.felem
let poly1305_padded r_elem text acc = let len = length text in let n = len / Poly.size_block in let r = len % Poly.size_block in let blocks = Seq.slice text 0 (n * Poly.size_block) in let rem = Seq.slice text (n * Poly.size_block) len in let acc = Poly.poly1305_update blocks acc r_elem in let tmp = create Poly.size_block (u8 0) in let tmp = update_sub tmp 0 r rem in // Only run the padded block if the initial text needed padding let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in acc
{ "file_name": "specs/Spec.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 5, "end_line": 45, "start_col": 0, "start_line": 33 }
module Spec.Chacha20Poly1305 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence module Poly = Spec.Poly1305 (* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *) #set-options "--max_fuel 0 --z3rlimit 30" /// Constants let size_key : size_nat = 32 (* in bytes *) let size_nonce : size_nat = 12 (* in bytes *) let size_block : size_nat = Poly.size_block let size_tag : size_nat = size_block /// Types type key = lbytes size_key type nonce = lbytes size_nonce type tag = lbytes size_tag /// Specification val poly1305_padded: r_elem:Poly.felem -> text:bytes -> acc:Poly.felem ->
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "Poly" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r_elem: Spec.Poly1305.felem -> text: Lib.ByteSequence.bytes -> acc: Spec.Poly1305.felem -> Spec.Poly1305.felem
Prims.Tot
[ "total" ]
[]
[ "Spec.Poly1305.felem", "Lib.ByteSequence.bytes", "Prims.op_GreaterThan", "Spec.Poly1305.poly1305_update1", "Spec.Poly1305.size_block", "Prims.bool", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.l_and", "Prims.eq2", "Lib.Sequence.sub", "Prims.l_Forall", "Prims.nat", "Prims.l_or", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Prims.op_Addition", "FStar.Seq.Base.index", "Lib.Sequence.to_seq", "Lib.Sequence.index", "Lib.Sequence.update_sub", "Lib.IntTypes.uint_t", "FStar.Seq.Base.seq", "FStar.Seq.Base.create", "Lib.IntTypes.mk_int", "Prims.l_imp", "Lib.Sequence.create", "Lib.IntTypes.u8", "Spec.Poly1305.poly1305_update", "FStar.Seq.Base.slice", "FStar.Mul.op_Star", "Prims.int", "Prims.op_Modulus", "Prims.op_Division", "Lib.Sequence.length" ]
[]
false
false
false
true
false
let poly1305_padded r_elem text acc =
let len = length text in let n = len / Poly.size_block in let r = len % Poly.size_block in let blocks = Seq.slice text 0 (n * Poly.size_block) in let rem = Seq.slice text (n * Poly.size_block) len in let acc = Poly.poly1305_update blocks acc r_elem in let tmp = create Poly.size_block (u8 0) in let tmp = update_sub tmp 0 r rem in let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in acc
false
Spec.Chacha20Poly1305.fst
Spec.Chacha20Poly1305.poly1305_do
val poly1305_do: k:Poly.key -> m:bytes{length m <= maxint U64} -> aad:bytes{length aad <= maxint U64} -> Tot Poly.tag
val poly1305_do: k:Poly.key -> m:bytes{length m <= maxint U64} -> aad:bytes{length aad <= maxint U64} -> Tot Poly.tag
let poly1305_do k m aad = let acc, r = Poly.poly1305_init k in let acc = if (length aad <> 0) then poly1305_padded r aad acc else acc in let acc = if (length m <> 0) then poly1305_padded r m acc else acc in let aad_len8 = uint_to_bytes_le #U64 (u64 (length aad)) in let ciphertext_len8 = uint_to_bytes_le #U64 (u64 (length m)) in let block = aad_len8 @| ciphertext_len8 in let acc = Poly.poly1305_update1 r 16 block acc in Poly.poly1305_finish k acc
{ "file_name": "specs/Spec.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 28, "end_line": 60, "start_col": 0, "start_line": 52 }
module Spec.Chacha20Poly1305 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence module Poly = Spec.Poly1305 (* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *) #set-options "--max_fuel 0 --z3rlimit 30" /// Constants let size_key : size_nat = 32 (* in bytes *) let size_nonce : size_nat = 12 (* in bytes *) let size_block : size_nat = Poly.size_block let size_tag : size_nat = size_block /// Types type key = lbytes size_key type nonce = lbytes size_nonce type tag = lbytes size_tag /// Specification val poly1305_padded: r_elem:Poly.felem -> text:bytes -> acc:Poly.felem -> Tot Poly.felem let poly1305_padded r_elem text acc = let len = length text in let n = len / Poly.size_block in let r = len % Poly.size_block in let blocks = Seq.slice text 0 (n * Poly.size_block) in let rem = Seq.slice text (n * Poly.size_block) len in let acc = Poly.poly1305_update blocks acc r_elem in let tmp = create Poly.size_block (u8 0) in let tmp = update_sub tmp 0 r rem in // Only run the padded block if the initial text needed padding let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in acc val poly1305_do: k:Poly.key -> m:bytes{length m <= maxint U64} -> aad:bytes{length aad <= maxint U64} ->
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "Poly" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Spec.Poly1305.key -> m: Lib.ByteSequence.bytes{Lib.Sequence.length m <= Lib.IntTypes.maxint Lib.IntTypes.U64} -> aad: Lib.ByteSequence.bytes{Lib.Sequence.length aad <= Lib.IntTypes.maxint Lib.IntTypes.U64} -> Spec.Poly1305.tag
Prims.Tot
[ "total" ]
[]
[ "Spec.Poly1305.key", "Lib.ByteSequence.bytes", "Prims.b2t", "Prims.op_LessThanOrEqual", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.IntTypes.maxint", "Lib.IntTypes.U64", "Spec.Poly1305.felem", "Spec.Poly1305.poly1305_finish", "Spec.Poly1305.poly1305_update1", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Prims.op_Addition", "Prims.eq2", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.append", "Lib.Sequence.op_At_Bar", "Lib.IntTypes.numbytes", "Lib.ByteSequence.uint_to_bytes_le", "Lib.IntTypes.u64", "Prims.op_disEquality", "Prims.int", "Spec.Chacha20Poly1305.poly1305_padded", "Prims.bool", "Spec.Poly1305.tag", "FStar.Pervasives.Native.tuple2", "Spec.Poly1305.poly1305_init" ]
[]
false
false
false
false
false
let poly1305_do k m aad =
let acc, r = Poly.poly1305_init k in let acc = if (length aad <> 0) then poly1305_padded r aad acc else acc in let acc = if (length m <> 0) then poly1305_padded r m acc else acc in let aad_len8 = uint_to_bytes_le #U64 (u64 (length aad)) in let ciphertext_len8 = uint_to_bytes_le #U64 (u64 (length m)) in let block = aad_len8 @| ciphertext_len8 in let acc = Poly.poly1305_update1 r 16 block acc in Poly.poly1305_finish k acc
false
FStar.DM4F.Heap.IntStoreFixed.fst
FStar.DM4F.Heap.IntStoreFixed.to_id
val to_id (n:nat{n < store_size}) : id
val to_id (n:nat{n < store_size}) : id
let to_id n = n
{ "file_name": "examples/dm4free/FStar.DM4F.Heap.IntStoreFixed.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 15, "end_line": 23, "start_col": 0, "start_line": 23 }
(* 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.DM4F.Heap.IntStoreFixed open FStar.Seq let id = i:nat{i < store_size} let heap = h:seq int{length h == store_size}
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "FStar.DM4F.Heap.IntStoreFixed.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat{n < FStar.DM4F.Heap.IntStoreFixed.store_size} -> FStar.DM4F.Heap.IntStoreFixed.id
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "FStar.DM4F.Heap.IntStoreFixed.store_size", "FStar.DM4F.Heap.IntStoreFixed.id" ]
[]
false
false
false
false
false
let to_id n =
n
false
L0Types.fst
L0Types.deviceIDCRI_t
val deviceIDCRI_t : Type0
val deviceIDCRI_t : Type0
let deviceIDCRI_t : Type0 = UInt32.t
{ "file_name": "share/steel/examples/pulse/dice/l0/L0Types.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 36, "end_line": 24, "start_col": 0, "start_line": 24 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module L0Types open Pulse.Lib.Pervasives let x509_version_t : Type0 = UInt32.t let x509_serialNumber_t : Type0 = UInt32.t
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Pervasives.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "L0Types.fst" }
[ { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "HACL", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "US" }, { "abbrev": true, "full_module": "Pulse.Lib.Vec", "short_module": "V" }, { "abbrev": true, "full_module": "Pulse.Lib.Reference", "short_module": "R" }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt32.t" ]
[]
false
false
false
true
true
let deviceIDCRI_t:Type0 =
UInt32.t
false
Spec.Chacha20Poly1305.fst
Spec.Chacha20Poly1305.aead_encrypt
val aead_encrypt: k:key -> n:nonce -> m:bytes{length m <= max_size_t} -> aad:bytes{length aad <= maxint U64} -> Tot (res:bytes{length res == length m + Poly.size_block})
val aead_encrypt: k:key -> n:nonce -> m:bytes{length m <= max_size_t} -> aad:bytes{length aad <= maxint U64} -> Tot (res:bytes{length res == length m + Poly.size_block})
let aead_encrypt k n m aad = let cipher = Spec.Chacha20.chacha20_encrypt_bytes k n 1 m in let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in let poly_k = sub key0 0 32 in let mac = poly1305_do poly_k cipher aad in Seq.append cipher mac
{ "file_name": "specs/Spec.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 73, "start_col": 0, "start_line": 68 }
module Spec.Chacha20Poly1305 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence module Poly = Spec.Poly1305 (* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *) #set-options "--max_fuel 0 --z3rlimit 30" /// Constants let size_key : size_nat = 32 (* in bytes *) let size_nonce : size_nat = 12 (* in bytes *) let size_block : size_nat = Poly.size_block let size_tag : size_nat = size_block /// Types type key = lbytes size_key type nonce = lbytes size_nonce type tag = lbytes size_tag /// Specification val poly1305_padded: r_elem:Poly.felem -> text:bytes -> acc:Poly.felem -> Tot Poly.felem let poly1305_padded r_elem text acc = let len = length text in let n = len / Poly.size_block in let r = len % Poly.size_block in let blocks = Seq.slice text 0 (n * Poly.size_block) in let rem = Seq.slice text (n * Poly.size_block) len in let acc = Poly.poly1305_update blocks acc r_elem in let tmp = create Poly.size_block (u8 0) in let tmp = update_sub tmp 0 r rem in // Only run the padded block if the initial text needed padding let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in acc val poly1305_do: k:Poly.key -> m:bytes{length m <= maxint U64} -> aad:bytes{length aad <= maxint U64} -> Tot Poly.tag let poly1305_do k m aad = let acc, r = Poly.poly1305_init k in let acc = if (length aad <> 0) then poly1305_padded r aad acc else acc in let acc = if (length m <> 0) then poly1305_padded r m acc else acc in let aad_len8 = uint_to_bytes_le #U64 (u64 (length aad)) in let ciphertext_len8 = uint_to_bytes_le #U64 (u64 (length m)) in let block = aad_len8 @| ciphertext_len8 in let acc = Poly.poly1305_update1 r 16 block acc in Poly.poly1305_finish k acc val aead_encrypt: k:key -> n:nonce -> m:bytes{length m <= max_size_t} -> aad:bytes{length aad <= maxint U64} ->
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "Poly" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Spec.Chacha20Poly1305.key -> n: Spec.Chacha20Poly1305.nonce -> m: Lib.ByteSequence.bytes{Lib.Sequence.length m <= Lib.IntTypes.max_size_t} -> aad: Lib.ByteSequence.bytes{Lib.Sequence.length aad <= Lib.IntTypes.maxint Lib.IntTypes.U64} -> res: Lib.ByteSequence.bytes {Lib.Sequence.length res == Lib.Sequence.length m + Spec.Poly1305.size_block}
Prims.Tot
[ "total" ]
[]
[ "Spec.Chacha20Poly1305.key", "Spec.Chacha20Poly1305.nonce", "Lib.ByteSequence.bytes", "Prims.b2t", "Prims.op_LessThanOrEqual", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.IntTypes.max_size_t", "Lib.IntTypes.maxint", "Lib.IntTypes.U64", "FStar.Seq.Base.append", "Spec.Poly1305.tag", "Spec.Chacha20Poly1305.poly1305_do", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Prims.l_and", "Prims.eq2", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.slice", "Prims.op_Addition", "Prims.l_Forall", "Prims.nat", "Prims.op_LessThan", "Prims.l_or", "FStar.Seq.Base.index", "Lib.Sequence.index", "Lib.Sequence.sub", "Spec.Chacha20.chacha20_encrypt_bytes", "Lib.Sequence.create", "Lib.IntTypes.u8", "Lib.Sequence.seq", "Prims.int", "Spec.Poly1305.size_block" ]
[]
false
false
false
false
false
let aead_encrypt k n m aad =
let cipher = Spec.Chacha20.chacha20_encrypt_bytes k n 1 m in let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in let poly_k = sub key0 0 32 in let mac = poly1305_do poly_k cipher aad in Seq.append cipher mac
false
Spec.Chacha20Poly1305.fst
Spec.Chacha20Poly1305.aead_decrypt
val aead_decrypt: k:key -> n:nonce -> c:bytes{length c <= max_size_t} -> mac:tag -> aad:bytes{length aad <= maxint U64} -> Tot (option (lbytes (length c)))
val aead_decrypt: k:key -> n:nonce -> c:bytes{length c <= max_size_t} -> mac:tag -> aad:bytes{length aad <= maxint U64} -> Tot (option (lbytes (length c)))
let aead_decrypt k n cipher mac aad = let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in let poly_k = sub key0 0 32 in let computed_mac = poly1305_do poly_k cipher aad in if lbytes_eq computed_mac mac then let plain = Spec.Chacha20.chacha20_encrypt_bytes k n 1 cipher in Some plain else None
{ "file_name": "specs/Spec.Chacha20Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 11, "end_line": 89, "start_col": 0, "start_line": 82 }
module Spec.Chacha20Poly1305 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence module Poly = Spec.Poly1305 (* RFC7539: https://tools.ietf.org/html/rfc7539#section-2.8 *) #set-options "--max_fuel 0 --z3rlimit 30" /// Constants let size_key : size_nat = 32 (* in bytes *) let size_nonce : size_nat = 12 (* in bytes *) let size_block : size_nat = Poly.size_block let size_tag : size_nat = size_block /// Types type key = lbytes size_key type nonce = lbytes size_nonce type tag = lbytes size_tag /// Specification val poly1305_padded: r_elem:Poly.felem -> text:bytes -> acc:Poly.felem -> Tot Poly.felem let poly1305_padded r_elem text acc = let len = length text in let n = len / Poly.size_block in let r = len % Poly.size_block in let blocks = Seq.slice text 0 (n * Poly.size_block) in let rem = Seq.slice text (n * Poly.size_block) len in let acc = Poly.poly1305_update blocks acc r_elem in let tmp = create Poly.size_block (u8 0) in let tmp = update_sub tmp 0 r rem in // Only run the padded block if the initial text needed padding let acc = if r > 0 then Poly.poly1305_update1 r_elem Poly.size_block tmp acc else acc in acc val poly1305_do: k:Poly.key -> m:bytes{length m <= maxint U64} -> aad:bytes{length aad <= maxint U64} -> Tot Poly.tag let poly1305_do k m aad = let acc, r = Poly.poly1305_init k in let acc = if (length aad <> 0) then poly1305_padded r aad acc else acc in let acc = if (length m <> 0) then poly1305_padded r m acc else acc in let aad_len8 = uint_to_bytes_le #U64 (u64 (length aad)) in let ciphertext_len8 = uint_to_bytes_le #U64 (u64 (length m)) in let block = aad_len8 @| ciphertext_len8 in let acc = Poly.poly1305_update1 r 16 block acc in Poly.poly1305_finish k acc val aead_encrypt: k:key -> n:nonce -> m:bytes{length m <= max_size_t} -> aad:bytes{length aad <= maxint U64} -> Tot (res:bytes{length res == length m + Poly.size_block}) let aead_encrypt k n m aad = let cipher = Spec.Chacha20.chacha20_encrypt_bytes k n 1 m in let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in let poly_k = sub key0 0 32 in let mac = poly1305_do poly_k cipher aad in Seq.append cipher mac val aead_decrypt: k:key -> n:nonce -> c:bytes{length c <= max_size_t} -> mac:tag -> aad:bytes{length aad <= maxint U64} ->
{ "checked_file": "/", "dependencies": [ "Spec.Poly1305.fst.checked", "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Chacha20Poly1305.fst" }
[ { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "Poly" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Spec.Chacha20Poly1305.key -> n: Spec.Chacha20Poly1305.nonce -> c: Lib.ByteSequence.bytes{Lib.Sequence.length c <= Lib.IntTypes.max_size_t} -> mac: Spec.Chacha20Poly1305.tag -> aad: Lib.ByteSequence.bytes{Lib.Sequence.length aad <= Lib.IntTypes.maxint Lib.IntTypes.U64} -> FStar.Pervasives.Native.option (Lib.ByteSequence.lbytes (Lib.Sequence.length c))
Prims.Tot
[ "total" ]
[]
[ "Spec.Chacha20Poly1305.key", "Spec.Chacha20Poly1305.nonce", "Lib.ByteSequence.bytes", "Prims.b2t", "Prims.op_LessThanOrEqual", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.IntTypes.max_size_t", "Spec.Chacha20Poly1305.tag", "Lib.IntTypes.maxint", "Lib.IntTypes.U64", "Lib.ByteSequence.lbytes_eq", "Spec.Poly1305.size_block", "FStar.Pervasives.Native.Some", "Lib.ByteSequence.lbytes", "Lib.Sequence.seq", "Lib.IntTypes.int_t", "Prims.eq2", "Prims.nat", "Spec.Chacha20.chacha20_encrypt_bytes", "Prims.bool", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option", "Spec.Poly1305.tag", "Spec.Chacha20Poly1305.poly1305_do", "Lib.Sequence.lseq", "Prims.l_and", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.slice", "Prims.op_Addition", "Prims.l_Forall", "Prims.op_LessThan", "Prims.l_or", "FStar.Seq.Base.index", "Lib.Sequence.index", "Lib.Sequence.sub", "Lib.Sequence.create", "Lib.IntTypes.u8" ]
[]
false
false
false
false
false
let aead_decrypt k n cipher mac aad =
let key0:lbytes 64 = Spec.Chacha20.chacha20_encrypt_bytes k n 0 (create 64 (u8 0)) in let poly_k = sub key0 0 32 in let computed_mac = poly1305_do poly_k cipher aad in if lbytes_eq computed_mac mac then let plain = Spec.Chacha20.chacha20_encrypt_bytes k n 1 cipher in Some plain else None
false
L0Types.fst
L0Types.deviceIDCSR_t
val deviceIDCSR_t : Type0
val deviceIDCSR_t : Type0
let deviceIDCSR_t : Type0 = UInt32.t
{ "file_name": "share/steel/examples/pulse/dice/l0/L0Types.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 36, "end_line": 26, "start_col": 0, "start_line": 26 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module L0Types open Pulse.Lib.Pervasives let x509_version_t : Type0 = UInt32.t let x509_serialNumber_t : Type0 = UInt32.t let deviceIDCRI_t : Type0 = UInt32.t
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Pervasives.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "L0Types.fst" }
[ { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "HACL", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "US" }, { "abbrev": true, "full_module": "Pulse.Lib.Vec", "short_module": "V" }, { "abbrev": true, "full_module": "Pulse.Lib.Reference", "short_module": "R" }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt32.t" ]
[]
false
false
false
true
true
let deviceIDCSR_t:Type0 =
UInt32.t
false
L0Types.fst
L0Types.x509_serialNumber_t
val x509_serialNumber_t : Type0
val x509_serialNumber_t : Type0
let x509_serialNumber_t : Type0 = UInt32.t
{ "file_name": "share/steel/examples/pulse/dice/l0/L0Types.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 42, "end_line": 22, "start_col": 0, "start_line": 22 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module L0Types open Pulse.Lib.Pervasives let x509_version_t : Type0 = UInt32.t
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Pervasives.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "L0Types.fst" }
[ { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "HACL", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "US" }, { "abbrev": true, "full_module": "Pulse.Lib.Vec", "short_module": "V" }, { "abbrev": true, "full_module": "Pulse.Lib.Reference", "short_module": "R" }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt32.t" ]
[]
false
false
false
true
true
let x509_serialNumber_t:Type0 =
UInt32.t
false
FStar.DM4F.Heap.IntStoreFixed.fst
FStar.DM4F.Heap.IntStoreFixed.id
val id : eqtype
val id : eqtype
let id = i:nat{i < store_size}
{ "file_name": "examples/dm4free/FStar.DM4F.Heap.IntStoreFixed.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 20, "start_col": 0, "start_line": 20 }
(* 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.DM4F.Heap.IntStoreFixed open FStar.Seq
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "FStar.DM4F.Heap.IntStoreFixed.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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.eqtype
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "FStar.DM4F.Heap.IntStoreFixed.store_size" ]
[]
false
false
false
true
false
let id =
i: nat{i < store_size}
false
FStar.DM4F.Heap.IntStoreFixed.fst
FStar.DM4F.Heap.IntStoreFixed.heap
val heap : eqtype
val heap : eqtype
let heap = h:seq int{length h == store_size}
{ "file_name": "examples/dm4free/FStar.DM4F.Heap.IntStoreFixed.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 44, "end_line": 21, "start_col": 0, "start_line": 21 }
(* 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.DM4F.Heap.IntStoreFixed open FStar.Seq
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "FStar.DM4F.Heap.IntStoreFixed.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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.eqtype
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.seq", "Prims.int", "Prims.eq2", "FStar.Seq.Base.length", "FStar.DM4F.Heap.IntStoreFixed.store_size" ]
[]
false
false
false
true
false
let heap =
h: seq int {length h == store_size}
false
L0Types.fst
L0Types.aliasKeyTBS_t
val aliasKeyTBS_t : Type0
val aliasKeyTBS_t : Type0
let aliasKeyTBS_t : Type0 = UInt32.t
{ "file_name": "share/steel/examples/pulse/dice/l0/L0Types.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 36, "end_line": 28, "start_col": 0, "start_line": 28 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module L0Types open Pulse.Lib.Pervasives let x509_version_t : Type0 = UInt32.t let x509_serialNumber_t : Type0 = UInt32.t let deviceIDCRI_t : Type0 = UInt32.t let deviceIDCSR_t : Type0 = UInt32.t
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Pervasives.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "L0Types.fst" }
[ { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "HACL", "short_module": null }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "US" }, { "abbrev": true, "full_module": "Pulse.Lib.Vec", "short_module": "V" }, { "abbrev": true, "full_module": "Pulse.Lib.Reference", "short_module": "R" }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt32.t" ]
[]
false
false
false
true
true
let aliasKeyTBS_t:Type0 =
UInt32.t
false
FStar.HyperStack.All.fst
FStar.HyperStack.All.all_post'
val all_post' : a: Type -> pre: Type -> Type
let all_post' (a:Type) (pre:Type) = all_post_h' HyperStack.mem a pre
{ "file_name": "ulib/FStar.HyperStack.All.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 68, "end_line": 20, "start_col": 0, "start_line": 20 }
(* Copyright 2008-2014 Nikhil Swamy and 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.HyperStack.All include FStar.HyperStack.ST
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "FStar.HyperStack.All.fst" }
[ { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> pre: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "FStar.Pervasives.all_post_h'", "FStar.Monotonic.HyperStack.mem" ]
[]
false
false
false
true
true
let all_post' (a pre: Type) =
all_post_h' HyperStack.mem a pre
false